using System.Collections.Generic;
using Engine.Core;
namespace Engine.Physics2D;
/// 
/// Represents a 2D physics engine.
/// 
public interface IPhysicsEngine2D
{
    /// 
    /// Event triggered when the  has done a single physics iteration.
    /// 
    Event OnPhysicsIteration { get; }
    /// 
    /// Event triggered when the  has done a full physics step/>.
    /// 
    Event OnPhysicsStep { get; }
    /// 
    /// The number of iterations the  performs per step.
    /// 
    int IterationPerStep { get; set; }
    /// 
    /// Advances the physics simulation by the specified time.
    /// 
    /// The time step.
    void Step(float deltaTime);
    /// 
    /// Advances the physics simulation by the specified time on a single .
    /// 
    /// The  to be progressed individually.
    /// The time step.
    void StepIndividual(IRigidBody2D rigidBody, float deltaTime);
    /// 
    /// Casts a  into the scene and returns the closest  it hits, if any.
    /// 
    /// The  to cast.
    /// The maximum distance to check for intersections. Defaults to .
    /// 
    /// A  containing information about the hit, or  if no hit was detected.
    /// 
    RaycastResult? Raycast(Ray2D ray, float length = float.MaxValue);
    /// 
    /// Casts a  into the scene and stores all hit results in the provided list.
    /// 
    /// The  to cast.
    /// 
    /// A list to which all s will be added. The list will be populated with zero or more  objects.
    /// 
    /// The maximum distance to check for intersections. Defaults to .
    void Raycast(Ray2D ray, IList results, float length = float.MaxValue);
    readonly record struct PhysicsIterationArguments(IPhysicsEngine2D Sender, float IterationDeltaTime);
    readonly record struct PhysicsStepArguments(IPhysicsEngine2D Sender, float StepDeltaTime);
}