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; } } } }
public void endCurrentSession() { gameOver = true; CubeSpawner.globalSpawning = false; EnemyCarMove.stopCubes = true; ui.gameOverOn(); }
void OnCollisionEnter2D(Collision2D col) { if (col.gameObject.tag == "enemy") { Destroy(gameObject); ui.gameOverOn(); } }