Syntriax.Engine/Engine.Physics2D/Abstract/ICollider2D.cs

48 lines
1.6 KiB
C#

using Syntriax.Engine.Core.Abstract;
namespace Syntriax.Engine.Physics2D.Abstract;
/// <summary>
/// Represents a 2D collider.
/// </summary>
public interface ICollider2D : IBehaviour, IAssignableTransform
{
/// <summary>
/// Event triggered when a collision is detected.
/// </summary>
event OnCollisionDetectedDelegate? OnCollisionDetected;
/// <summary>
/// Event triggered when a collision is resolved.
/// </summary>
event OnCollisionResolvedDelegate? OnCollisionResolved;
/// <summary>
/// Event triggered when another <see cref="ICollider2D"/> triggers this <see cref="ICollider2D"/>.
/// </summary>
event OnTriggeredDelegate? OnTriggered;
/// <summary>
/// The <see cref="IRigidBody2D"/> associated with the <see cref="ICollider2D"/>.
/// </summary>
IRigidBody2D? RigidBody2D { get; }
/// <summary>
/// The value indicating whether the <see cref="ICollider2D"/> is a trigger.
/// </summary>
bool IsTrigger { get; set; }
/// <summary>
/// Recalculates <see cref="ICollider2D"/> properties.
/// </summary>
void Recalculate();
void Detect(CollisionDetectionInformation collisionDetectionInformation);
void Resolve(CollisionDetectionInformation collisionDetectionInformation);
void Trigger(ICollider2D initiator);
delegate void OnCollisionDetectedDelegate(ICollider2D sender, CollisionDetectionInformation collisionDetectionInformation);
delegate void OnCollisionResolvedDelegate(ICollider2D sender, CollisionDetectionInformation collisionDetectionInformation);
delegate void OnTriggeredDelegate(ICollider2D sender, ICollider2D initiatorCollider);
}