protected override EnemyShip makeEnemyShip(String typeOfShip) { EnemyShip theEnemyShip = null; // If UFO was sent grab use the factory that knows // what types of weapons and engines a regular UFO // needs. The EnemyShip object is returned & given a name if (typeOfShip.Equals("UFO")) { EnemyShipFactory shipPartsFactory = new UFOEnemyShipFactory(); theEnemyShip = new UFOEnemyShip(shipPartsFactory); theEnemyShip.setName("UFO Grunt Ship"); } else // If UFO BOSS was sent grab use the factory that knows // what types of weapons and engines a Boss UFO // needs. The EnemyShip object is returned & given a name if (typeOfShip.Equals("UFO BOSS")) { EnemyShipFactory shipPartsFactory = new UFOBossEnemyShipFactory(); theEnemyShip = new UFOBossEnemyShip(shipPartsFactory); theEnemyShip.setName("UFO Boss Ship"); } return(theEnemyShip); }
// Make Ship varies per ship type... protected override EnemyShip MakeEnemyShip(ShipType type) { EnemyShip ship = null; if (type == ShipType.UFO) { IEnemyShipFactory factory = new UFOEnemyShipFactory(); ship = new UFOEnemyShip(factory); ship.name = "UFO"; } return(ship); }
// Make Ship varies per ship type... protected override EnemyShip MakeEnemyShip(ShipType type) { EnemyShip ship = null; if(type == ShipType.UFO) { IEnemyShipFactory factory = new UFOEnemyShipFactory(); ship = new UFOEnemyShip(factory); ship.name = "UFO"; } return ship; }