48 lines
1.7 KiB
C#
48 lines
1.7 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 OnCollisionDetectedEventHandler? OnCollisionDetected;
|
|
|
|
/// <summary>
|
|
/// Event triggered when a collision is resolved.
|
|
/// </summary>
|
|
event OnCollisionResolvedEventHandler? OnCollisionResolved;
|
|
|
|
/// <summary>
|
|
/// Event triggered when another <see cref="ICollider2D"/> triggers this <see cref="ICollider2D"/>.
|
|
/// </summary>
|
|
event OnTriggeredEventHandler? 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 OnCollisionDetectedEventHandler(ICollider2D sender, CollisionDetectionInformation collisionDetectionInformation);
|
|
delegate void OnCollisionResolvedEventHandler(ICollider2D sender, CollisionDetectionInformation collisionDetectionInformation);
|
|
delegate void OnTriggeredEventHandler(ICollider2D sender, ICollider2D initiatorCollider);
|
|
}
|