void OnTriggerEnter(Collider col) { string collided_with_tag = col.gameObject.tag; if (collided_with_tag == "Red" || collided_with_tag == "Blue" || collided_with_tag == "Green") { Destroy(col.gameObject); if (col.gameObject.CompareTag(color_tag)) { movement_script.score_acc += 10; movement_script.Absolute_score += 1; audio_script.playMatchingHit(); } else if (movement_script.score_acc > 1) { movement_script.score_acc = movement_script.score_acc / 2; audio_script.playNonMatchingHit(); } else { audio_script.MuteFX(); GameObject.FindGameObjectWithTag("GameMusic").GetComponent <AudioSource>().Stop(); deathMenu.showDeathMenu(movement_script.Absolute_score); this.enabled = false; } } }
public void Die() { isDead = true; updateHighScore(); updateCoinHighscore(); updateTotalCoins(); updateTotalMeterWalked(); deathMenu.showDeathMenu(score); coins = 0; }