public RemoveTerminal ( |
||
terminal | ||
return | void |
//sets the airport expansion to an airport public static void SetAirportExpansion(Airport airport, AirportExpansion expansion, bool onStartUp = false) { if (expansion.Type == AirportExpansion.ExpansionType.Name) { if (expansion.NotifyOnChange && !onStartUp) { GameObject.GetInstance() .NewsBox.AddNews( new News( News.NewsType.AirportNews, GameObject.GetInstance().GameTime, "Airport Name Changed", $"[LI airport={airport.Profile.IATACode}]({new AirportCodeConverter().Convert(airport)}) has changed its name to {expansion.Name}")); } airport.Profile.Name = expansion.Name; } if (expansion.Type == AirportExpansion.ExpansionType.NewRunway) { var runway = new Runway(expansion.Name, expansion.Length, Runway.RunwayType.Regular, expansion.Surface, expansion.Date, true); airport.Runways.Add(runway); if (expansion.NotifyOnChange && !onStartUp) { GameObject.GetInstance() .NewsBox.AddNews( new News( News.NewsType.AirportNews, GameObject.GetInstance().GameTime, "New Runway", $"[LI airport={airport.Profile.IATACode}]({new AirportCodeConverter().Convert(airport)}) has created a new runway")); } } if (expansion.Type == AirportExpansion.ExpansionType.RunwayLength) { Runway runway = airport.Runways.FirstOrDefault(r => r.Name == expansion.Name); if (runway != null) { if (expansion.NotifyOnChange && !onStartUp) { GameObject.GetInstance() .NewsBox.AddNews( new News( News.NewsType.AirportNews, GameObject.GetInstance().GameTime, "New Terminal", $"[LI airport={airport.Profile.IATACode}]({new AirportCodeConverter().Convert(airport)}) has changed the length of the runway {expansion.Name} to {new SmallDistanceToUnitConverter().Convert(expansion.Length, null, null, null)}")); } } } if (expansion.Type == AirportExpansion.ExpansionType.NewTerminal) { var terminal = new Terminal(airport, expansion.Name, expansion.Gates, expansion.Date, expansion.TerminalType); airport.AddTerminal(terminal); if (expansion.NotifyOnChange && !onStartUp) { GameObject.GetInstance() .NewsBox.AddNews( new News( News.NewsType.AirportNews, GameObject.GetInstance().GameTime, "New Terminal", $"[LI airport={airport.Profile.IATACode}]({new AirportCodeConverter().Convert(airport)}) has created a new terminal with {expansion.Gates} gates")); } } if (expansion.Type == AirportExpansion.ExpansionType.ExtraGates) { Terminal terminal = airport.Terminals.AirportTerminals.FirstOrDefault(t => t.Name == expansion.Name); if (terminal != null) { for (int i = 0; i < expansion.Gates; i++) terminal.Gates.AddGate(new Gate(expansion.Date)); if (expansion.NotifyOnChange && !onStartUp) { GameObject.GetInstance() .NewsBox.AddNews( new News( News.NewsType.AirportNews, GameObject.GetInstance().GameTime, "New Gates at Airport", $"[LI airport={airport.Profile.IATACode}]({new AirportCodeConverter().Convert(airport)}) has created {expansion.Gates} gates in {expansion.Name}")); } } } if (expansion.Type == AirportExpansion.ExpansionType.CloseTerminal) { Terminal terminal = airport.Terminals.AirportTerminals.FirstOrDefault(t => t.Name == expansion.Name); if (terminal != null) { airport.RemoveTerminal(terminal); if (expansion.NotifyOnChange && !onStartUp) { GameObject.GetInstance() .NewsBox.AddNews( new News( News.NewsType.AirportNews, GameObject.GetInstance().GameTime, "Closed Terminal", $"[LI airport={airport.Profile.IATACode}]({new AirportCodeConverter().Convert(airport)}) has closed its terminal {expansion.Name}")); } } } //close terminal }