void OnTriggerEnter(Collider other) { if (other.tag == "Boundary" || other.tag == "Enemy" || other.tag == "Ad") { return; } if (explosion != null) { Instantiate(explosion, transform.position, transform.rotation); } if (other.tag == "Player") { Instantiate(playerExplosion, other.transform.position, other.transform.rotation); gameController.GameOver(); deathsNumber += 1; PlayerPrefs.SetInt("Deaths number:", deathsNumber); if (canIShowAd == 1 || deathsNumber == 4) { ShowAd(); deathsNumber = 0; PlayerPrefs.SetInt("Deaths number:", deathsNumber); } if (deathsNumber > 4) { deathsNumber = 0; PlayerPrefs.SetInt("Deaths number:", deathsNumber); } } gameController.AddCoins(coinsValue); gameController.AddLevelCoins(levelCoinsValue); gameController.AddLevelScore(levelScoreValue); Destroy(other.gameObject); Destroy(gameObject); }