void OnCollisionEnter(Collision c) { if (c.gameObject.tag == "Obstacle") { // print("COLLISION"); print(this.gameObject.name); Color hisColor = c.gameObject.GetComponent <Renderer>().material.color; Color myColor = this.gameObject.GetComponent <Renderer>().material.color; if (hisColor == myColor) { // print("SAME MATERIAL"); score += 10; if (!SoundManager.mute) { scoreGainAudio.Play(); StartCoroutine(wait(scoreGainAudio.clip.length)); } } else { score /= 2; if (!SoundManager.mute) { scoreLossAudio.Play(); StartCoroutine(wait(scoreLossAudio.clip.length)); } // print("Score " + score); if (score == 0) { PlayerMove.SetStop(true); deathMenu.Dead(); } } GameObject.Destroy(c.gameObject); } }