2024-01-23 18:39:25 +03:00
|
|
|
using System;
|
2024-01-25 21:54:39 +03:00
|
|
|
|
2024-01-23 18:39:25 +03:00
|
|
|
using Syntriax.Engine.Core.Abstract;
|
|
|
|
|
|
|
|
namespace Syntriax.Engine.Physics2D.Abstract;
|
|
|
|
|
2024-02-01 12:26:28 +03:00
|
|
|
/// <summary>
|
|
|
|
/// Represents a 2D collider.
|
|
|
|
/// </summary>
|
2024-01-23 18:39:25 +03:00
|
|
|
public interface ICollider2D : IBehaviour, IAssignableTransform
|
|
|
|
{
|
2024-02-01 12:26:28 +03:00
|
|
|
/// <summary>
|
|
|
|
/// Event triggered when a collision is detected.
|
|
|
|
/// </summary>
|
2024-01-27 19:59:27 +03:00
|
|
|
Action<ICollider2D, CollisionDetectionInformation>? OnCollisionDetected { get; set; }
|
2024-02-01 12:26:28 +03:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Event triggered when a collision is resolved.
|
|
|
|
/// </summary>
|
2024-01-27 19:22:59 +03:00
|
|
|
Action<ICollider2D, CollisionDetectionInformation>? OnCollisionResolved { get; set; }
|
2024-01-23 18:39:25 +03:00
|
|
|
|
2024-02-01 12:26:28 +03:00
|
|
|
/// <summary>
|
|
|
|
/// Event triggered when another <see cref="ICollider2D"/> triggers this <see cref="ICollider2D"/>.
|
|
|
|
/// </summary>
|
2024-01-27 20:31:51 +03:00
|
|
|
Action<ICollider2D, ICollider2D>? OnTriggered { get; set; }
|
|
|
|
|
2024-02-01 12:26:28 +03:00
|
|
|
/// <summary>
|
|
|
|
/// The <see cref="IRigidBody2D"/> associated with the <see cref="ICollider2D"/>.
|
|
|
|
/// </summary>
|
2024-01-23 18:39:25 +03:00
|
|
|
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-01-23 18:39:25 +03:00
|
|
|
|
2024-02-01 12:26:28 +03:00
|
|
|
/// <summary>
|
|
|
|
/// Recalculates <see cref="ICollider2D"/> properties.
|
|
|
|
/// </summary>
|
2024-01-23 18:39:25 +03:00
|
|
|
void Recalculate();
|
|
|
|
}
|