/// <summary> /// Constructor for the Flight class that allows creation with explicit X and Y values /// </summary> /// <param name="name">Flight Name</param> /// <param name="model">Aircraft Model</param> /// <param name="type">Flight Type</param> /// <param name="dest">Destination Navpoint</param> /// <param name="altitude">Current altitude</param> /// <param name="speed">Current speed</param> /// <param name="heading">Current heading</param> /// <param name="x">Current Location on the X-axis</param> /// <param name="y">Current Location on the Y-axis</param> public Flight(string name, AircraftModel model, FlightPhase type, ref Waypoint dest, int altitude = 0, int speed = 0, int heading = 0, double x = 0, double y = 0) { this._name = name; this._model = model; this._type = type; this._destination = dest; this._altitude = altitude; this._speed = speed; this._heading = heading; this._location = new Location(x, y); this._targetAltitude = 0; }
/// <summary> /// Updates the information about this flight /// </summary> /// <param name="dest">Destination Navpoint</param> /// <param name="altitude">Current altitude</param> /// <param name="speed">Current speed</param> /// <param name="location">Current location</param> public void Update(ref Waypoint dest, int altitude, int speed, Location location) { this._destination = dest; this._altitude = altitude; this._location = location; this._speed = speed; }
/// <summary> /// Updates the information about this flight /// </summary> /// <param name="data">Flight object to update from</param> public void Update(Flight data) { if(data.Name == this._name) { this._destination = data._destination; this._altitude = data._altitude; this._location = data._location; this._speed = data._speed; } else { throw new Exception("FATAL: Flight objects do not match."); } }