Example #1
0
    public void BuySelected()
    {
        //Called from button, so need to get variables from main gameManager ↓
        if (GetGameManager().selectedTile != null && UIManager.GetUIManager().currentSelection != -1)
        {
            float buildingCost = UIManager.GetUIManager().lastBuilding.GetComponent <BuildingCost>().cost;

            if (!MoneyTracker.GetMoneyTracker().CanAfford(buildingCost))
            {
                AudioManager.GetAudioManager().PlayDenied();
                return;
            }

            MoneyTracker.GetMoneyTracker().BuyFor(buildingCost);

            GameObject gameObject = UIManager.GetUIManager().lastBuilding;

            if (gameObject.name == "Nuclear Plant" && !GetGameManager().nuclearAlready)
            {
                SnapshotManager.GetSnapshotManager().FirstNuclear();
            }
            else
            {
                GetGameManager().nuclearAlready = true;
            }

            if (GetGameManager().selectedTile.CreateBuilding(UIManager.GetUIManager().lastBuilding))
            {
                UIManager.GetUIManager().lastBuilding.GetComponent <BuildSound>().Play();
            }
            UIManager.GetUIManager().ShowMenu(true, GetGameManager().selectedTile);
        }
    }
Example #2
0
 // Use this for initialization
 void Start()
 {
     SnapshotManager.GetSnapshotManager().FirstNuclear();
 }