public ILegion CreateLegion(string legionType) { IFactionFactory factionFactory = null; switch (legionType.ToLower()) { case "rebel": Legion = new RebelArmy(); factionFactory = new RebelFactionFactory(); break; case "imperial": Legion = new ImperialArmy(); factionFactory = new ImperialFactionFactory(); break; case "imperialimpostors": Legion = new RebelArmy(); factionFactory = new ImperialFactionFactory(); break; } if (factionFactory != null) { Legion.PrepareArmy(factionFactory); return(Legion); } else { throw new ArgumentException("Could not initialize IFactionFactory"); } }
public override void PrepareArmy(IFactionFactory factionFactory) { factionFactory.Legion = this; factionFactory.RecruitAeronautical(); factionFactory.RecruitAuxiliary(); factionFactory.RecruitBattery(); factionFactory.RecruitInfantry(); factionFactory.RecruitKnights(); factionFactory.RecruitReconnaissance(); }