private static Commando GetCommando(string[] commandoParams) { SpecializedSoldier specSoldier = GetSpecializedSoldier(commandoParams); if (specSoldier == null) { return(null); } List <Mission> missions = new List <Mission>(); for (int i = 5; i < commandoParams.Length; i += 2) { string missionCodeName = commandoParams[i]; if (!Enum.TryParse(commandoParams[i + 1], out Enums.MissionState missionState)) { continue; } Mission mission = new Mission(missionCodeName, missionState); missions.Add(mission); } return(new Commando(specSoldier, missions)); }
private static Engineer GetEngineer(string[] engineerParams) { SpecializedSoldier specSoldier = GetSpecializedSoldier(engineerParams); if (specSoldier == null) { return(null); } List <Repair> repairs = new List <Repair>(); for (int i = 5; i < engineerParams.Length; i += 2) { string repairPart = engineerParams[i]; int repairHours = int.Parse(engineerParams[i + 1]); Repair repair = new Repair(repairPart, repairHours); repairs.Add(repair); } return(new Engineer(specSoldier, repairs)); }
public Commando(SpecializedSoldier specSoldier, IEnumerable <Mission> missions) : this(specSoldier.Id, specSoldier.FirstName, specSoldier.LastName, specSoldier.Salary, specSoldier.Corps, missions) { }
public Engineer(SpecializedSoldier specSoldier, IEnumerable <Repair> repairs) : this(specSoldier.Id, specSoldier.FirstName, specSoldier.LastName, specSoldier.Salary, specSoldier.Corps, repairs) { }