internal void EnsurePopulated() { if (Lights == null) { Lights = new AircraftConfigurationLights(); } Lights.EnsurePopulated(); if (Engines == null) { Engines = new AircraftConfigurationEngines(); } Engines.EnsurePopulated(); if (!GearDown.HasValue) { GearDown = true; } if (!FlapsPercent.HasValue) { FlapsPercent = 0; } if (!SpoilersDeployed.HasValue) { SpoilersDeployed = false; } if (!OnGround.HasValue) { OnGround = true; } }
internal AircraftConfigurationEngines CreateIncremental(AircraftConfigurationEngines cfg) { EnsurePopulated(); cfg.EnsurePopulated(); if (cfg.Equals(this)) { return(null); } AircraftConfigurationEngines inc = new AircraftConfigurationEngines(); if (HasEngine1Object && cfg.HasEngine1Object) { inc.Engine1 = Engine1.CreateIncremental(cfg.Engine1); } if (HasEngine2Object && cfg.HasEngine2Object) { inc.Engine2 = Engine2.CreateIncremental(cfg.Engine2); } if (HasEngine3Object && cfg.HasEngine3Object) { inc.Engine3 = Engine3.CreateIncremental(cfg.Engine3); } if (HasEngine4Object && cfg.HasEngine4Object) { inc.Engine4 = Engine4.CreateIncremental(cfg.Engine4); } return(inc); }
internal static AircraftConfiguration FromUserAircraftData(UserAircraftData uad) { AircraftConfiguration cfg = new AircraftConfiguration { Lights = AircraftConfigurationLights.FromUserAircraftData(uad), Engines = AircraftConfigurationEngines.FromUserAircraftData(uad), GearDown = uad.GearDown, FlapsPercent = RoundUpToNearest5(uad.FlapsPercentage), SpoilersDeployed = uad.SpeedBrakeDeployed, OnGround = uad.OnGround }; return(cfg); }
internal void ApplyIncremental(AircraftConfigurationEngines inc) { if (inc.HasEngine1Object && HasEngine1Object) { Engine1.ApplyIncremental(inc.Engine1); } if (inc.HasEngine2Object && HasEngine2Object) { Engine2.ApplyIncremental(inc.Engine2); } if (inc.HasEngine3Object && HasEngine3Object) { Engine3.ApplyIncremental(inc.Engine3); } if (inc.HasEngine4Object && HasEngine4Object) { Engine4.ApplyIncremental(inc.Engine4); } }
internal static AircraftConfigurationEngines FromUserAircraftData(UserAircraftData uad) { AircraftConfigurationEngines ace = new AircraftConfigurationEngines(); if (uad.EngineCount >= 1) { ace.Engine1 = AircraftConfigurationEngine.FromUserAircraftData(uad, 1); } if (uad.EngineCount >= 2) { ace.Engine2 = AircraftConfigurationEngine.FromUserAircraftData(uad, 2); } if (uad.EngineCount >= 3) { ace.Engine3 = AircraftConfigurationEngine.FromUserAircraftData(uad, 3); } if (uad.EngineCount >= 4) { ace.Engine4 = AircraftConfigurationEngine.FromUserAircraftData(uad, 4); } return(ace); }
internal AircraftConfigurationEngines Clone() { AircraftConfigurationEngines clone = new AircraftConfigurationEngines(); if (HasEngine1Object) { clone.Engine1 = Engine1.Clone(); } if (HasEngine2Object) { clone.Engine2 = Engine2.Clone(); } if (HasEngine3Object) { clone.Engine3 = Engine3.Clone(); } if (HasEngine4Object) { clone.Engine4 = Engine4.Clone(); } return(clone); }