// Update is called once per frame void Update() { if (turnSystem.Turn == TurnSystem.turn.GameTurn && doOnce) { planetControls.ZoomOut(); uiPositioner.ExitWindow(); if (buildButtonBool == false) { OpenBuildButton(); } StartCoroutine(GameTurnCycle()); doOnce = false; } if (townhall.Count > 0) { stats.townhallStarter = false; } stats.population = population.Count; //Tutorial if (stats.townhallStarter) { tutBuildTownHallUI.SetActive(true); } else { tutBuildTownHallUI.SetActive(false); } if (mine.minecartSent == false) { } }
public void DestroyBuilding() { bool doOnce = true; uiPositioner.ExitWindow(); if ((clickedGameObject.tag == "TownHall" || clickedGameObject.tag == "House1" || clickedGameObject.tag == "House2" || clickedGameObject.tag == "House3") && doOnce) { for (int i = 0; i < clickedGameObject.GetComponent <Occupance>().occupanceAmount; i++) { GameObject inhabitant = gameManager.assignedpopulation[Random.Range(0, gameManager.assignedpopulation.Count)]; gameManager.assignedpopulation.Remove(inhabitant); gameManager.population.Add(inhabitant); } } if (clickedGameObject.tag == "TownHall" && doOnce) { stats.wood += Mathf.RoundToInt(stats.townhallWoodCost * stats.recycleMultiplier); gameManager.townhall.Remove(this.gameObject); } if (clickedGameObject.tag == "House1" && doOnce) { stats.wood += Mathf.RoundToInt(stats.house1WoodCost * stats.recycleMultiplier); gameManager.house1.Remove(this.gameObject); } if (clickedGameObject.tag == "House2" && doOnce) { stats.wood += Mathf.RoundToInt(stats.house2WoodCost * stats.recycleMultiplier); gameManager.house2.Remove(this.gameObject); } if (clickedGameObject.tag == "House3" && doOnce) { stats.wood += Mathf.RoundToInt(stats.house3WoodCost * stats.recycleMultiplier); gameManager.house3.Remove(this.gameObject); } if (clickedGameObject.tag == "Windmill" && doOnce) { stats.wood += Mathf.RoundToInt(stats.windmillWoodCost * stats.recycleMultiplier); gameManager.windmill.Remove(this.gameObject); } if (clickedGameObject.tag == "Factory" && doOnce) { stats.wood += Mathf.RoundToInt(stats.factoryWoodCost * stats.recycleMultiplier); gameManager.factories.Remove(this.gameObject); } if (clickedGameObject.tag == "Farm" && doOnce) { stats.wood += Mathf.RoundToInt(stats.farmWoodCost * stats.recycleMultiplier); gameManager.farm.Remove(this.gameObject); } doOnce = false; Destroy(clickedGameObject.GetComponentInParent <Transform>().parent.gameObject); }