private Fleet CreateFleet(ShipDefinition ships) { Fleet fleet = new Fleet(); for (int i = 0; i < ships.m_numInterceptors; i++) { Interceptor interceptor; if (ships.m_interceptorUpgrades.Count > 0) { interceptor = new Interceptor(ships.m_interceptorUpgrades); } else { interceptor = new Interceptor(); } fleet.AddShip(interceptor); } for (int i = 0; i < ships.m_numCruisers; i++) { Cruiser cruiser; if (ships.m_cruiserUpgrades.Count > 0) { cruiser = new Cruiser(ships.m_cruiserUpgrades); } else { cruiser = new Cruiser(); } fleet.AddShip(cruiser); } for (int i = 0; i < ships.m_numDreadnaughts; i++) { Dreadnaught dreadnaught; if (ships.m_dreadnaughtUpgrades.Count > 0) { dreadnaught = new Dreadnaught(ships.m_dreadnaughtUpgrades); } else { dreadnaught = new Dreadnaught(); } fleet.AddShip(dreadnaught); } for (int i = 0; i < ships.m_numOrbitals; i++) { Orbital orbital; if (ships.m_orbitalUpgrades.Count > 0) { orbital = new Orbital(ships.m_orbitalUpgrades); } else { orbital = new Orbital(); } fleet.AddShip(orbital); } for (int i = 0; i < ships.m_numAncients; i++) { Ancient ancient = new Ancient(); fleet.AddShip(ancient); } for (int i = 0; i < ships.m_numCenterBases; i++) { CenterBase centerBase = new CenterBase(); fleet.AddShip(centerBase); } return(fleet); }
public Battle(ShipDefinition attackerShips, ShipDefinition defenderShips) { attackerFleet = CreateFleet(attackerShips); defenderFleet = CreateFleet(defenderShips); }