Esempio n. 1
0
    public void Upgrade()
    {
        if (upgrUI.gameObject.GetComponent <UpgradeUIScript>().tower != null && upgrUI.gameObject.GetComponent <UpgradeUIScript>().tower.upgradeOne&& !upgrUI.gameObject.GetComponent <UpgradeUIScript>().tower.upgradeTwo)
        {
            if (ws.gameObject.GetComponent <Player>().money >= upgrUI.GetComponent <UpgradeUIScript>().tower.upgradeTwoCost)
            {
                Debug.Log("Paspaustas upgrade ant tower lvl 2 ir pinigu uztenka");
                upgrUI.GetComponent <UpgradeUIScript>().tower.upgradeTowerTwo();
                upgrUI.GetComponent <UpgradeUIScript>().UpdateInfoTowerTwo();
            }
            else
            {
                Debug.Log("Paspaustas upgrade ant tower lvl 2 ir pinigu neuztenka");
                errorMsgScript errMsg = err.GetComponent <errorMsgScript>();
                errMsg.NotEnoughMoney();
            }
        }
        if (upgrUI.gameObject.GetComponent <UpgradeUIScript>().tower != null && !upgrUI.gameObject.GetComponent <UpgradeUIScript>().tower.upgradeOne&& !upgrUI.gameObject.GetComponent <UpgradeUIScript>().tower.upgradeTwo)
        {
            if (ws.gameObject.GetComponent <Player>().money >= upgrUI.GetComponent <UpgradeUIScript>().tower.upgradeOneCost)
            {
                Debug.Log("Paspaustas upgrade ant tower lvl 1 ir pinigu uztenka");
                upgrUI.GetComponent <UpgradeUIScript>().tower.upgradeTowerOne();
                upgrUI.GetComponent <UpgradeUIScript>().UpdateInfoTowerTwo();
            }
            else
            {
                Debug.Log("Paspaustas upgrade ant tower lvl 1 ir neuztenka");
                errorMsgScript errMsg = err.GetComponent <errorMsgScript>();
                errMsg.NotEnoughMoney();
            }
        }

        if (upgrUI.gameObject.GetComponent <UpgradeUIScript>().farm != null && !upgrUI.gameObject.GetComponent <UpgradeUIScript>().farm.upgradeOne)
        {
            if (ws.gameObject.GetComponent <Player>().money >= upgrUI.GetComponent <UpgradeUIScript>().farm.upgradeOneCost)
            {
                Debug.Log("Paspaustas upgrade ant farm ir pinigu uztenka");
                upgrUI.GetComponent <UpgradeUIScript>().farm.upgradeFarmOne(upgrUI.GetComponent <UpgradeUIScript>());
                upgrUI.GetComponent <UpgradeUIScript>().UpdateInfoFarm();
            }
            else
            {
                Debug.Log("Paspaustas upgrade ant farm ir pinigu neuztenka");
                errorMsgScript errMsg = err.GetComponent <errorMsgScript>();
                errMsg.NotEnoughMoney();
            }
        }
    }
Esempio n. 2
0
 public void BuyEnemy(int enemyNumber)
 {
     if (player.money >= enemyPrices[enemyNumber])
     {
         Transform enemy;
         enemy = Instantiate(prefabs[enemyNumber], spawnerP2.position, spawnerP2.rotation);
         k     = enemy.GetComponent <Enemy>();
         k.getPlayer(player2);
         kk = enemy.GetComponent <HeyImWalkingHere>();
         kk.getPlayer(player2);
         player.incomeMoney(-enemyPrices[enemyNumber]);
     }
     else
     {
         errorMsgScript errMsg = errorMsgs.GetComponent <errorMsgScript>();
         errMsg.NotEnoughMoney();
         Debug.Log("neuzteko pinigu fermai");
     }
 }
Esempio n. 3
0
 public void BuildMeniu(int number)
 {
     if (number == 4)
     {
         if (p.money >= prefabs[number].GetComponent <Farm>().price)
         {
             mapMovementActive = true;
             mapMovementActivation();
             bm = true;
             selectedBuilding = false;
             buildingNumber   = number;
             Debug.Log("uzteko pinigu fermai");
         }
         else
         {
             errorMsgScript errMsg = errorMsgs.GetComponent <errorMsgScript>();
             errMsg.NotEnoughMoney();
             Debug.Log("neuzteko pinigu fermai");
         }
     }
     if (number < 4)
     {
         if (p.money >= prefabs[number].GetComponent <Tower>().price)
         {
             mapMovementActive = true;
             mapMovementActivation();
             bm = true;
             selectedBuilding = false;
             buildingNumber   = number;
             Debug.Log("uzteko pinigu bokstui");
         }
         else
         {
             errorMsgScript errMsg = errorMsgs.GetComponent <errorMsgScript>();
             errMsg.NotEnoughMoney();
             Debug.Log("neuzteko pinigu bokstui");
         }
     }
 }