Esempio n. 1
0
    public void OnBuyFence()
    {
        if (Wallet.GetTotalCoins() < Config.FenceValue)
        {
            return;
        }

        Wallet.SpendCoins(Config.FenceValue);
        GameInput.SetState(GameInput.InputState.Placement);
        SetPlacementInstance(Config.Fence);
    }
Esempio n. 2
0
    public void UpgradeClick()
    {
        if (_playerWallet.Coins < Int32.Parse(_upgradeCost))
        {
            HighlightedImage.color = Color.red;
            NotEnoughCashText.gameObject.SetActive(true);
            StartCoroutine(SetBack());
            return;
        }

        HighlightedImage.color = Color.cyan;
        _playerWallet.SpendCoins(Int32.Parse(_upgradeCost));

        if (ButtonValue == "WEAPON")
        {
            _upgradeable.SetLevel(_upgradeable.GetLevel() + 1);
            _upgradeable.SetAttack(Int32.Parse(UpgradeCost.GetStats()[_upgradeable.GetLevel()].ToString()));
        }
        else if (ButtonValue == "DEFENCE")
        {
            _playerAttack.HealthLevel += 1;
            _playerAttack.Defence      = Int32.Parse(UpgradeCost.GetDefenceStats()[_playerAttack.HealthLevel].ToString());
        }

        StartCoroutine(SetBack());
    }