/// <summary> /// Launches a spawned missile at the given target. /// </summary> /// <param name="target">If no target is given, the missile will fire without guidance.</param> /// <param name="velocity">Used to give a missile with a drop delay an initial velocity. Typical /// use case would be passing in the velocity of the launching platform.</param> public override void Launch(Transform target, Vector3 velocity) { base.Launch(target, velocity); // Peek instead of dequeue so that failed launch commands don't cycle the stations. HardpointStation launchingStation = stations.Peek(); if (launchingStation != null) { bool launchSuccessful = launchingStation.Launch(target, velocity); if (launchSuccessful) { if (fireSource != null) { fireSource.Play(); } // Put this station back at the end of the queue after a launch. stations.Dequeue(); stations.Enqueue(launchingStation); missileCount--; } } }