41 lines
1.4 KiB
C#
41 lines
1.4 KiB
C#
using Syntriax.Engine.Core;
|
|
|
|
namespace Syntriax.Engine.Physics2D;
|
|
|
|
/// <summary>
|
|
/// Represents a 2D physics engine.
|
|
/// </summary>
|
|
public interface IPhysicsEngine2D
|
|
{
|
|
/// <summary>
|
|
/// Event triggered when the <see cref="IPhysicsEngine2D"/> has done a single physics iteration.
|
|
/// </summary>
|
|
Event<IPhysicsEngine2D, float> OnPhysicsIteration { get; }
|
|
|
|
/// <summary>
|
|
/// Event triggered when the <see cref="IPhysicsEngine2D"/> has done a full physics step/>.
|
|
/// </summary>
|
|
Event<IPhysicsEngine2D, float> OnPhysicsStep { get; }
|
|
|
|
/// <summary>
|
|
/// The number of iterations the <see cref="IPhysicsEngine2D"/> performs per step.
|
|
/// </summary>
|
|
int IterationPerStep { get; set; }
|
|
|
|
/// <summary>
|
|
/// Advances the physics simulation by the specified time.
|
|
/// </summary>
|
|
/// <param name="deltaTime">The time step.</param>
|
|
void Step(float deltaTime);
|
|
|
|
/// <summary>
|
|
/// Advances the physics simulation by the specified time on a single <see cref="IRigidBody2D"/>.
|
|
/// </summary>
|
|
/// <param name="rigidBody">The <see cref="IRigidBody2D"/> to be progressed individually.</param>
|
|
/// <param name="deltaTime">The time step.</param>
|
|
void StepIndividual(IRigidBody2D rigidBody, float deltaTime);
|
|
|
|
readonly record struct PhysicsIterationArguments(IPhysicsEngine2D sender, float iterationDeltaTime);
|
|
readonly record struct PhysicsStepArguments(IPhysicsEngine2D sender, float stepDeltaTime);
|
|
}
|