public override void HandleTurn(City pCity) { if (!_turnEnded) { if (Time.time - _prevBuild >= Glob.AIBuildDelay) { if (_buildings == null) { _buildings = Glob.GetBuildingPrefabs(); } City targetCity = pCity; _prevBuild = Time.time; if (currentMode == CurrentMode.MISSILEAIM) { targetCity = GameInitializer.GetNextCity(pCity); launchMissile(getBestFactory(targetCity)); targetCity = pCity; GameInitializer.GetCameraManager().MoveCameraTo(targetCity.transform.position + Glob.CameraCityOffset, Glob.CameraCitySwitchTime / 2, 4); pCity.AddMissileLaunched(); return; } Move myMove = getMove(pCity, _difficulty, pCity.GetCurrentTurn() * 2); pCity.SetSelectedTile(myMove._tile); //Select the tile pCity.GetSelectedTile().Reset(); GameInitializer.GetBuildingHandler().ChangeBuildingSelection(myMove._building); GameInitializer.GetBuildingHandler().StartBuilding(); if (pCity.GetBudget() < 20 && currentMode != CurrentMode.MISSILEAIM) { _turnEnded = true; _turnEndTime = Time.time; } else if (currentMode == CurrentMode.MISSILEAIM) { targetCity = GameInitializer.GetNextCity(pCity); GameInitializer.GetCameraManager().MoveCameraTo(targetCity.transform.position + Glob.CameraCityOffset, Glob.CameraCitySwitchTime / 2, 4); targetCity.SetSelectedTile(getBestFactory(targetCity)); _prevBuild = Time.time + Glob.AIMissileDelay; } } } else if (Time.time - _turnEndTime >= Glob.AIEndTurnDelay) { GameInitializer.EndTurn(); _turnEnded = false; } }
public void QuickBuildBuilding(City pCity, CustomTile pCustomTile, int pBuildingIndex) { if (buildings == null) { buildings = Glob.GetBuildingPrefabs(); } Building buildingToPlace = Instantiate(buildings[pBuildingIndex]); buildingToPlace.SetBuildingTile(pCustomTile); pCustomTile.SetBuilding(buildingToPlace); //The prefab center is scuffed. if (buildingToPlace is MayorOffice) { pCity.SetMayorOffice(buildingToPlace as MayorOffice); } buildingToPlace.SetBuildingPhase(Building.BuildingPhase.DONE); }
//Do not open /!\ Hazardous /!\ private void Initialize() { _buildInfoPanel = GameObject.FindGameObjectWithTag("BuildingInfoPanel"); _buildInfoText = _buildInfoPanel.GetComponentInChildren <Text>(); _buildInfoPanel.SetActive(false); _buildPanel = GameObject.FindGameObjectWithTag("BuildPanel"); _buildPanel.SetActive(false); _scrollView = _buildPanel.GetComponentInChildren <ScrollRect>(); _bottomBar = GameObject.FindGameObjectWithTag("BottomBar"); _notificationPanel = GameObject.FindGameObjectWithTag("NotificationPanel"); _notificationPanel.SetActive(false); _notificationText = _notificationPanel.GetComponentInChildren <Text>(); _turnCounter = GameObject.FindGameObjectWithTag("TurnCounter").GetComponent <Text>(); _eventMenu = GameObject.FindGameObjectWithTag("EventMenu"); _valuesPanel = GameObject.FindGameObjectWithTag("Values"); //_budgetSlider = GameObject.FindGameObjectWithTag("BudgetSlider").GetComponent<Slider>(); //_budgetText = _budgetSlider.GetComponentInChildren<Text>(); _examinePanel = GameObject.FindGameObjectWithTag("ExaminePanel"); _examineText = _examinePanel.GetComponentInChildren <Text>(); _examinePanel.SetActive(false); _resolutionScreen = GameObject.FindGameObjectWithTag("ResolutionScreen"); _resolutionScreen.SetActive(false); _resolutionPlayerType = _resolutionScreen.GetComponentsInChildren <Text>()[0]; _resolutionExplanation = _resolutionScreen.GetComponentsInChildren <Text>()[1]; _resolutionRecommendation = _resolutionScreen.GetComponentsInChildren <Text>()[2]; _resolutionStats = _resolutionScreen.GetComponentsInChildren <Text>()[3]; _buildings = Glob.GetBuildingPrefabs(); }
// Use this for initialization void Start() { _soundHandler = GameInitializer.GetSoundHandler(); buildings = Glob.GetBuildingPrefabs(); }
// Use this for initialization void Start() { _buildings = Glob.GetBuildingPrefabs(); }