public static MissionObjectBase createNewObject(String name) { if (name.Equals("ab")) { return(new AirBase()); } else if (name.Equals("ac")) { return(carrier = new AircraftCarrier()); } else if (name.Equals("bs")) { return(new BattleShip()); } else if (name.Equals("b")) { return(new Bridge()); } else if (name.Equals("c")) { return(new Chopper()); } else if (name.Equals("f1")) { return(new Aircraft()); } else if (name.Equals("gt")) { return(new GuardTower()); } else if (name.Equals("i")) { return(island = new Island()); } else if (name.Equals("db")) { return(darkBlaze = new JuliusAircraft()); } else if (name.Equals("r")) { return(refueler = new MidAirRefueler()); } else if (name.Equals("pp")) { return(new PowerPlant()); } else if (name.Equals("rs")) { return(new RadarTower()); } else if (name.Equals("sb")) { return(new SAM()); } else if (name.Equals("t")) { return(new Tank()); } else if (name.Equals("tg")) { return(new TrainingCamp()); } else if (name.Equals("o")) { return(player = new Aircraft(false)); //create player } else if (name.Equals("lb")) { return(landingBeacon = new LandingBeacon()); } else { return(null); } }
public static MissionObjectBase createNewObject(String name) { if (name.Equals("ab")) { return(new AirBase()); } else if (name.Equals("ac")) { return(carrier = new AircraftCarrier()); } else if (name.Equals("bs")) { return(new BattleShip()); } else if (name.Equals("b")) { return(new Bridge()); } else if (name.Equals("c")) { return(new Chopper()); } else if (name.StartsWith("f") && name.Length == 2) // f1 to fn (single digit) { return(new Aircraft(name)); } else if (name.Equals("gt")) { return(new GuardTower()); } else if (name.Equals("i")) { return(island = new Island()); } else if (name.Equals("db")) { return(darkBlaze = new JuliusAircraft()); } else if (name.Equals("r")) { return(refueler = new MidAirRefueler()); } else if (name.Equals("pp")) { return(new PowerPlant()); } else if (name.Equals("rs")) { return(new RadarTower()); } else if (name.Equals("sb")) { return(new SAM()); } else if (name.Equals("t")) { return(new Tank()); } else if (name.Equals("tg")) { return(new TrainingCamp()); } else if (name.Equals("o")) { return(player = new Aircraft(false)); //create player } else if (name.Equals("lb")) { return(landingBeacon = new LandingBeacon()); } throw new ArgumentException($"The string {name} is not a valid object name."); }