/// <summary>
        /// Advance the Aircraft on the flight path as far as it can go in dt seconds.
        /// </summary>
        /// <param name="dt">how much time passed since the last Update</param>
        /// <returns>whether the end of the flight path is now reached</returns>
        internal bool Advanche(float dt)
        {
            // calculate how much distance can be crossed in dt
            var pathDifferenceInPercent = dt / Constants.TURN_DURATION;
            var distance = pathDifferenceInPercent * FlightPathNode.PathLength;

            //Console.WriteLine("distance " + distance);
            FlightPathNode.Advance(Aircraft.Position, distance, out CCPoint destination, out float CCfinalDirection);
            Aircraft.MoveTo(destination);
            Aircraft.RotateTo(CCfinalDirection);
            return(destination.Equals(FlightPathNode.EndPoint));
        }
 internal FlightPathControlNode(Aircraft aircraft)
 {
     if (!aircraft.ControlledByPlayer)
     {
         Visible = false;
     }
     Aircraft       = aircraft;
     FlightPathNode = new FlightPathNode();
     FlightPathHead = new FlightPathHead();
     AddChild(FlightPathNode);
     AddChild(FlightPathHead);
     Scale = 1f;
 }
 private void MoveHeadTo(float x, float y)
 {
     // move the head
     FlightPathHead.MoveTo(x, y);
     // if its a player aircraft make sure it doesn't move too far away from the others
     if (Layer is PlayLayer pl && pl.PlayerAircrafts != null && pl.PlayerAircrafts.Contains(Aircraft))
     {
         FlightPathHead.EnsureProximityToOtherPlayerHeads();
     }
     // recalculate the flight path
     Constants.CCDegreesToDxDy(Aircraft.MyRotation, out float dx, out float dy);
     FlightPathNode.CalculatePath(Aircraft.Position, dx, dy, FlightPathHead.Position);
     if (Aircraft.ControlledByPlayer)
     {
         FlightPathNode.DrawPath();
     }
     // rotate the head according to the direction (not the slope itself) at the end of the flight path
     FlightPathHead.MyRotation = FlightPathNode.DirectionAt(FlightPathNode.Path.Length - 1);
 }
 internal void ClearPathPoints()
 {
     FlightPathNode.ClearPath();
 }