void OnCollisionEnter2D(Collision2D col)
 {
     if (col.collider.tag == "Player")
     {
         controls Player = col.collider.GetComponent <controls>();
         if (this.tag == "EC")
         {
             Player.setEnergyCells(Qtd, false);
         }
         else if (this.tag == "PT")
         {
             Player.setPowerTanks(Qtd, false);
         }
         else if (this.tag == "WD")
         {
             Player.setWood(Qtd, false);
         }
         else if (this.tag == "MT")
         {
             Player.setMetal(Qtd, false);
         }
         else if (this.tag == "CN")
         {
             Player.setCannons(Qtd, false);
         }
         Destroy(gameObject);
     }
 }
Exemple #2
0
 public void MoneyBitch()
 {
     Recursos();
     if (ClickBtn.TowerPrefab.tag == "TorreAzul")
     {
         if (metal >= 100 && wood >= 25 && energycell >= 2 && cannons >= 1)
         {
             HaveMoney = true;
             Player.setMetal(100, true);
             Player.setEnergyCells(2, true);
             Player.setCannons(1, true);
             Player.setWood(25, true);
         }
         else
         {
             print("Bitch better have my money");
         }
     }
     else if (ClickBtn.TowerPrefab.tag == "TorreRoxa")
     {
         if (metal >= 100 && wood >= 25 && powertank >= 2)
         {
             HaveMoney = true;
             Player.setMetal(100, true);
             Player.setPowerTanks(2, true);
             Player.setWood(25, true);
         }
     }
     else if (ClickBtn.TowerPrefab.tag == "Eletrica")
     {
         if (metal >= 100 && wood >= 25 && powertank >= 2 && energycell >= 2 && cannons >= 1)
         {
             HaveMoney = true;
             Player.setMetal(100, true);
             Player.setPowerTanks(2, true);
             Player.setWood(25, true);
             Player.setEnergyCells(2, true);
             Player.setCannons(1, true);
         }
     }
 }