using System.Collections.Generic;

public class Trajectory
{
	private List<Sinusoid> _curves = null;

	/// <summary>
	/// Generic Trajectory constructor to not break game
	/// </summary>
	public Trajectory() : this(TrajectoryBank.Linear)
	{

	}

	public Trajectory(Sinusoid sinusoid)
	{
		_curves = new List<Sinusoid>();

		if (sinusoid != null)
		{
			AddCurve(sinusoid);
		}
	}

	public void AddCurve(Sinusoid sinusoid)
	{
		_curves.Add(sinusoid);
	}

	public float Evaluate(float time)
	{
		float sum = 0f;
		float nbCurves = _curves.Count;

		foreach(var curve in _curves)
		{
			sum += curve.GetPosition(time);
		}

		return sum / nbCurves;
	}
}
