public unsafe override void createMap(List<ICase> map, Queue<IPlayer> players) { WrapperMapAlgo algo = new WrapperMapAlgo(); CaseFactory factory = new CaseFactory(); int** algoMap = algo.createMap(height, width); int** algoBonusesMap = algo.createBonusesMap(height, width, 0.05); for (int j = 0; j < height; j++) { for (int i = 0; i < width; i++) { ICase newCase = factory.makeCase(algoMap[i][j]); newCase.SqPos = new int[2] { i, j }; switch (algoBonusesMap[i][j]) { case 1: IFruit newFruitCase = new Fruit(newCase); map.Add(newFruitCase); break; case 2: IIron newIronCase = new Iron(newCase); map.Add(newIronCase); break; default: map.Add(newCase); break; } } } //Ajout des unités initiales int** algoPosInit = algo.giveInitPos(height, width, players.Count); foreach (IPlayer player in players) { int i = algoPosInit[(int)player.Color][0], j = algoPosInit[(int)player.Color][1]; switch (player.Civilization) { case CivilizationType.EII: TeacherEII firstTeacherEII = new TeacherEII(player, map[i + width * j]); StudentEII firstStudentEII = new StudentEII(player, map[i + width * j]); map[i + width * j].addUnit(firstTeacherEII); map[i + width * j].addUnit(firstStudentEII); player.Teachers.Add(firstTeacherEII); player.Students.Add(firstStudentEII); break; case CivilizationType.INFO: TeacherINFO firstTeacherINFO = new TeacherINFO(player, map[i + width * j]); StudentINFO firstStudentINFO = new StudentINFO(player, map[i + width * j]); map[i + width * j].addUnit(firstTeacherINFO); map[i + width * j].addUnit(firstStudentINFO); player.Teachers.Add(firstTeacherINFO); player.Students.Add(firstStudentINFO); break; default: throw new ArgumentException(); } } }
public virtual void spawnUnit(ProductionType type) { switch (type) { case ProductionType.Boss : switch (Player.Civilization) { case CivilizationType.EII: BossEII newBossEII = new BossEII(Player, Position); Player.Boss = newBossEII; Position.Units.Add(newBossEII); break; case CivilizationType.INFO: BossINFO newBossINFO = new BossINFO(Player, Position); Player.Boss = newBossINFO; Position.Units.Add(newBossINFO); break; } break; case ProductionType.Student: switch (Player.Civilization) { case CivilizationType.EII: StudentEII newStudentEII = new StudentEII(Player, Position); Player.Students.Add(newStudentEII); Position.addUnit(newStudentEII); break; case CivilizationType.INFO: StudentINFO newStudentINFO = new StudentINFO(Player, Position); Player.Students.Add(newStudentINFO); Position.addUnit(newStudentINFO); break; } break; case ProductionType.Teacher : switch (Player.Civilization) { case CivilizationType.EII: TeacherEII newTeacherEII = new TeacherEII(Player, Position); Player.Teachers.Add(newTeacherEII); Position.addUnit(newTeacherEII); break; case CivilizationType.INFO: TeacherINFO newTeacherINFO = new TeacherINFO(Player, Position); Player.Teachers.Add(newTeacherINFO); Position.addUnit(newTeacherINFO); break; } break; } Current_prod = ProductionType.None; }