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 FlightPathHeadOnly() { FlightPathHead.ShowOnlyHead(); }