Syntriax.Engine/Engine.Physics2D/Collider2DBehaviourBase.cs

28 lines
988 B
C#
Raw Normal View History

2024-01-25 20:42:49 +03:00
using System;
using Syntriax.Engine.Core;
using Syntriax.Engine.Core.Abstract;
using Syntriax.Engine.Physics2D.Abstract;
namespace Syntriax.Engine.Physics2D;
public abstract class Collider2DBehaviourBase : BehaviourOverride, ICollider2D
{
public Action<ICollider2D, ICollider2D>? OnCollisionPreResolve { get; set; } = null;
public Action<ICollider2D, ICollider2D>? OnCollisionResolved { get; set; } = null;
protected IRigidBody2D? _rigidBody2D = null;
public IRigidBody2D? RigidBody2D => _rigidBody2D;
ITransform IAssignableTransform.Transform => Transform;
Action<IAssignableTransform>? IAssignableTransform.OnTransformAssigned { get => GameObject.OnTransformAssigned; set => GameObject.OnTransformAssigned = value; }
bool IAssignableTransform.Assign(ITransform transform) => GameObject.Assign(transform);
public abstract void Recalculate();
protected override void OnInitialize() => BehaviourController.TryGetBehaviour(out _rigidBody2D);
}