//какой из проектов: 1 - транспортник,2 - бомбардировщик, 3 -истребитель, 4 - разработать железо, 5 - разработать золото, 6 - разработать нефть, 0 - бесконечный проект public void AddProject(int project) { if (CheckResurses(project, identityGov)) { TownProject pr; switch (project) { case 1: pr = new TownProject("Транспортный самолёт", project, 5); projects.Enqueue(pr); break; case 2: pr = new TownProject("Бомбардировщик", project, 5); projects.Enqueue(pr); break; case 3: pr = new TownProject("Истребитель", project, 5); projects.Enqueue(pr); break; case 4: pr = new TownProject("Разработать железо", project, 5); projects.Enqueue(pr); break; case 5: pr = new TownProject("Разработать золото", project, 5); projects.Enqueue(pr); break; case 6: pr = new TownProject("Разработать нефть", project, 5); projects.Enqueue(pr); break; default: pr = new TownProject("Увеличить производство золота", project, 20); projects.Enqueue(pr); break; } } }
public void NextStepTown() { TownProject pr = null; if (projects.Count != 0) { pr = projects.Peek(); } HasVictim(getNeighbours((int)coordinate.x, (int)coordinate.y)); if (pr != null) { int step = pr.NextStepTownProject(); if (step == 0) { Transform transPref; Transform tr; Vector2 gridPos; AirplanBase data; switch (projects.Dequeue().GetNumberOfProject()) { case 1: transPref = grid.GetUnitPrefFinder().GetAirPref(0); tr = Instantiate(transPref) as Transform; gridPos = coordinate; //Debug.Log (CalcWorldPos (gridPos)); tr.position = grid.CalcWorldPos(gridPos); data = tr.GetComponent <TransportAircraft> (); data.setGrid(grid); data.setCountry(identityGov); data.setCoordinate(gridPos); grid.GetGameController().getGoverment(identityGov).SetUnit(data); //grid.GetGameController ().getGoverment (identityGov).newUnits.Add (data); tr.name = tr.GetComponent <TransportAircraft>().getNameAir() + identityGov; MapInfo.current.unitMap [(int)coordinate.x, (int)coordinate.y] = identityGov * 100 + data.getTypeOfAirplane(); break; case 2: transPref = grid.GetUnitPrefFinder().GetAirPref(2); tr = Instantiate(transPref) as Transform; gridPos = coordinate; //Debug.Log (CalcWorldPos (gridPos)); tr.position = grid.CalcWorldPos(gridPos); data = tr.GetComponent <Bomber>(); data.setGrid(grid); data.setCountry(identityGov); data.setCoordinate(gridPos); grid.GetGameController().getGoverment(identityGov).SetUnit(data); //grid.GetGameController ().getGoverment (identityGov).newUnits.Add (data); tr.name = tr.GetComponent <Bomber>().getNameAir() + identityGov; MapInfo.current.unitMap [(int)coordinate.x, (int)coordinate.y] = identityGov * 100 + data.getTypeOfAirplane(); break; case 3: transPref = grid.GetUnitPrefFinder().GetAirPref(1); tr = Instantiate(transPref) as Transform; gridPos = coordinate; //Debug.Log (CalcWorldPos (gridPos)); tr.position = grid.CalcWorldPos(gridPos); data = tr.GetComponent <Fighter>(); data.setGrid(grid); data.setCountry(identityGov); data.setCoordinate(gridPos); grid.GetGameController().getGoverment(identityGov).SetUnit(data); //grid.GetGameController ().getGoverment (identityGov).newUnits.Add (data); tr.name = tr.GetComponent <Fighter>().getNameAir() + identityGov; MapInfo.current.unitMap [(int)coordinate.x, (int)coordinate.y] = identityGov * 100 + data.getTypeOfAirplane(); break; case 4: //pr = new TownProject ("Разработать железо", project, 5); //projects.Enqueue (pr); foreach (Resourse res in resourses) { if (!res.GetActive() && (res.GetTypeRes() != -1 || res.GetTypeRes() != -4)) { grid.gameController.getGoverment(identityGov).SetStationIron(); res.Activate(); break; } } break; case 5: //pr = new TownProject ("Разработать золото", project, 5); //projects.Enqueue (pr); foreach (Resourse res in resourses) { if (!res.GetActive() && (res.GetTypeRes() != -2 || res.GetTypeRes() != -5)) { grid.gameController.getGoverment(identityGov).SetStationMoney(); res.Activate(); break; } } break; case 6: //pr = new TownProject ("Разработать нефть", project, 5); //projects.Enqueue (pr); foreach (Resourse res in resourses) { if (!res.GetActive() && (res.GetTypeRes() != -3 || res.GetTypeRes() != -6)) { grid.gameController.getGoverment(identityGov).SetStationOil(); res.Activate(); break; } } break; default: //pr = new TownProject ("Увеличить производство золота", project, 20); //projects.Enqueue (pr); break; } } } }