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

48 lines
1.6 KiB
C#
Raw Permalink Normal View History

using Syntriax.Engine.Core.Abstract;
namespace Syntriax.Engine.Physics2D.Abstract;
2024-02-01 12:26:28 +03:00
/// <summary>
/// Represents a 2D collider.
/// </summary>
public interface ICollider2D : IBehaviour, IAssignableTransform
{
2024-02-01 12:26:28 +03:00
/// <summary>
/// Event triggered when a collision is detected.
/// </summary>
2024-07-15 01:13:39 +03:00
event OnCollisionDetectedDelegate? OnCollisionDetected;
2024-02-01 12:26:28 +03:00
/// <summary>
/// Event triggered when a collision is resolved.
/// </summary>
2024-07-15 01:13:39 +03:00
event OnCollisionResolvedDelegate? OnCollisionResolved;
2024-02-01 12:26:28 +03:00
/// <summary>
/// Event triggered when another <see cref="ICollider2D"/> triggers this <see cref="ICollider2D"/>.
/// </summary>
2024-07-15 01:13:39 +03:00
event OnTriggeredDelegate? OnTriggered;
2024-01-27 20:31:51 +03:00
2024-02-01 12:26:28 +03:00
/// <summary>
/// The <see cref="IRigidBody2D"/> associated with the <see cref="ICollider2D"/>.
/// </summary>
IRigidBody2D? RigidBody2D { get; }
2024-02-01 12:26:28 +03:00
/// <summary>
/// The value indicating whether the <see cref="ICollider2D"/> is a trigger.
/// </summary>
2024-01-27 20:19:00 +03:00
bool IsTrigger { get; set; }
2024-02-01 12:26:28 +03:00
/// <summary>
/// Recalculates <see cref="ICollider2D"/> properties.
/// </summary>
void Recalculate();
2024-07-15 01:13:39 +03:00
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);
}