using OpenTK.Mathematics;

namespace DoomDeathmatch.Component.MVC.Model.Weapon;

public class RandomFlatSpreadShootPattern(float parAngle, uint parCount) : IShootPattern
{
  private readonly Random _random = new();

  public IEnumerable<Vector3> GetShootPattern(Vector3 parForward, Vector3 parUp, Vector3 parRight)
  {
    for (var i = 0; i < parCount; i++)
    {
      var angle = parAngle * ((float)_random.NextDouble() * 2 - 1);
      var delta = MathF.Tan(angle);

      var offset = parRight * delta;

      yield return offset;
    }
  }
}