void OnMouseDown() { if (gameObject.CompareTag("Breakable")) { Destroy(gameObject); AudioSource.PlayClipAtPoint(BreakSound, transform.position); scoreKeeper.IncreaseScore(); } else if (gameObject.CompareTag("Cocacola")) { scoreKeeper.DecreaseScore(); AudioSource.PlayClipAtPoint(ErrorSound, transform.position); } }
void OnCollisionEnter2D(Collision2D col) { Destroy(gameObject); AudioSource.PlayClipAtPoint(Break_Sound, this.transform.position); scoreKeeper.DecreaseScore(); }
void OnTriggerEnter2D(Collider2D col) { AudioSource.PlayClipAtPoint(Coin, transform.position); Destroy(col.gameObject); scoreKeeper.DecreaseScore(); }