Esempio n. 1
0
 void OnTriggerEnter(Collider other)
 {
     if (other.gameObject.name == "CoinPrefab(Clone)")
     {
         control.PowerupCollected();
         coins++;
         coinsText.text = "Coins: " + coins;
         other.gameObject.SetActive(false);
     }
     else
     {
         health         -= 10;
         healthText.text = "Health: " + health;
         other.gameObject.SetActive(false);
         if (health <= 50)
         {
             healthText.color = Color.red;
             if (health == 0)
             {
                 rend.enabled = false;
                 ui.gameOverOn();
                 box.enabled = false;
             }
         }
     }
 }
Esempio n. 2
0
 public void endCurrentSession()
 {
     gameOver = true;
     CubeSpawner.globalSpawning = false;
     EnemyCarMove.stopCubes     = true;
     ui.gameOverOn();
 }
Esempio n. 3
0
 void OnCollisionEnter2D(Collision2D col)
 {
     if (col.gameObject.tag == "enemy")
     {
         Destroy(gameObject);
         ui.gameOverOn();
     }
 }