protected override IMilitaryVehicle Create(string name) { Warplane warplane; var result = name.Replace(" ", "").ToLower(); if (result == "bleriot") { warplane = new Bleriot(); } else if (result == "spitfire") { warplane = new Spitfire(); } else if (result == "messerschmitt") { warplane = new Messerschmitt(); } else if (result == "nakajima") { warplane = new Nakajima(); } else if (result == "petlyakov") { warplane = new Petlyakov(); } else { return(null); } warplane.Fly(); return(warplane); }
public Warplane CreateWarplane(string name) { Warplane warplane; var result = name.Replace(" ", "").ToLower(); if (result == "bleriot") { warplane = new Bleriot(); } else if (result == "spitfire") { warplane = new Spitfire(); } else if (result == "messerschmitt") { warplane = new Messerschmitt(); } else if (result == "nakajima") { warplane = new Nakajima(); } else if (result == "petlyakov") { warplane = new Petlyakov(); } else { return(null); } return(warplane); }
public static void Main(string[] args) { var airTrafficControl = new AirTrafficControl(); var fighter1 = new Junkers("JC123", airTrafficControl); var fighter2 = new Lancaster("LA456", airTrafficControl); var fighter3 = new Mustang("MS789", airTrafficControl); var fighter4 = new Spitfire("SF3121", airTrafficControl); var fighter5 = new Stuka("ST6059", airTrafficControl); fighter1.Altitude += 25000; fighter2.Altitude += 25000; fighter3.Altitude += 25000; fighter4.Altitude += 25000; fighter5.Altitude += 25000; Console.ReadLine(); }
private IWeapon CreateFromRecognizedString(string recognizedName, IWeapon currentWeapon, float sensitivityScale) { var weaponName = recognizedName.FindMostSimilar(WeaponNamesToTypes.Keys); WeaponNamesToTypes.TryGetValue(weaponName, out var weaponType); var inGameName = weaponType.GetWeaponName(); IWeapon result; if (currentWeapon?.IsTheSameWeapon(inGameName) ?? weaponType == WeaponAL.Unknown) { return(currentWeapon); } var numOfMods = WeaponTypesToNumOfMods[weaponType]; switch (weaponType) { case WeaponAL.Wingman: case WeaponAL.MASTIFF: case WeaponAL.KRABER: case WeaponAL.Longbow: case WeaponAL.Peacekeeper: case WeaponAL.TripleTake: case WeaponAL.ChargedRifle: result = new NonAdjustableWeapon(inGameName, 0, recognizedName, numOfMods); break; case WeaponAL.Havoc: result = new Havoc(inGameName, 2, recognizedName, numOfMods); break; case WeaponAL.Devotion: result = new Devotion(inGameName, recognizedName, numOfMods); break; case WeaponAL.LStar: result = new LStar(inGameName, 2, recognizedName, numOfMods); break; case WeaponAL.Flatline: result = new Flatline(inGameName, 2, recognizedName, numOfMods); break; case WeaponAL.Hemlok: result = new Hemlok(inGameName, 2, recognizedName, numOfMods); break; case WeaponAL.Prowler: result = new Prowler(inGameName, 2, recognizedName, numOfMods); break; case WeaponAL.RE45: result = new RE45(inGameName, 2, recognizedName, numOfMods); break; case WeaponAL.R301: result = new R301(inGameName, 2, recognizedName, numOfMods); break; case WeaponAL.R99: result = new R99(inGameName, 1.5, recognizedName, numOfMods); break; case WeaponAL.Volt: result = new Volt(inGameName, 1.5, recognizedName, numOfMods); break; case WeaponAL.Alternator: result = new Alternator(inGameName, 2, recognizedName, numOfMods); break; case WeaponAL.G7Scout: result = new G7Scout(inGameName, 2, recognizedName, numOfMods); break; case WeaponAL.Spitfire: result = new Spitfire(inGameName, recognizedName, numOfMods); break; case WeaponAL.Unknown: case WeaponAL.EVA8Auto: case WeaponAL.Mozambique: case WeaponAL.P2020: result = new RegularAdjustmentWeapon(inGameName, 2, recognizedName, numOfMods); break; default: throw new ArgumentOutOfRangeException(); } result.SetSensitivityScale(sensitivityScale); this.OnWeaponCreated(result); return(result); }