Weapons/ProjectileSimulator.cs
/// <summary>
/// Tracks and simulates projectiles owned by a PlayerPawn so that
/// the owning client can run prediction on them.
/// </summary>
public sealed class ProjectileSimulator
{
	public List<Projectile> Projectiles { get; } = new();
	public PlayerPawn Owner { get; }

	public ProjectileSimulator( PlayerPawn owner ) => Owner = owner;

	public void Add( Projectile p ) => Projectiles.Add( p );
	public void Remove( Projectile p ) => Projectiles.Remove( p );

	public void Clear()
	{
		foreach ( var p in Projectiles.ToList() )
			p.GameObject?.Destroy();
		Projectiles.Clear();
	}

	public void Simulate()
	{
		for ( int i = Projectiles.Count - 1; i >= 0; i-- )
		{
			var proj = Projectiles[i];
			if ( !proj.IsValid() ) { Projectiles.RemoveAt( i ); continue; }

			proj.Simulate();
		}
	}
}