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

42 lines
1.2 KiB
C#

using System;
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>
Action<ICollider2D, CollisionDetectionInformation>? OnCollisionDetected { get; set; }
/// <summary>
/// Event triggered when a collision is resolved.
/// </summary>
Action<ICollider2D, CollisionDetectionInformation>? OnCollisionResolved { get; set; }
/// <summary>
/// Event triggered when another <see cref="ICollider2D"/> triggers this <see cref="ICollider2D"/>.
/// </summary>
Action<ICollider2D, ICollider2D>? OnTriggered { get; set; }
/// <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();
}