private void Kill() { if (isAlive) { CounterManager.addScore(30); } isAlive = false; StartCoroutine(KillToad()); }
// Mario collides the base private void OnTriggerEnter2D(Collider2D other) { var isSuperMarioHead = other.tag == "SuperMarioHead"; if (isSuperMarioHead) { CounterManager.addScore(10); var position = new Vector3(transform.position.x, transform.position.y + 1f, transform.position.z); Instantiate(Coin, position, transform.rotation); StartCoroutine(KillObject()); } }
private void OnCollisionEnter2D(Collision2D otherObject) { if (otherObject.collider.tag == "Floor") { isGrounded = true; } if (otherObject.collider.tag == "Vitals") { isColliderWithVitals = true; counterManager.addScore(); Destroy(otherObject.gameObject); } }
private void OnCollisionEnter2D(Collision2D other) { var isMario = other.gameObject.CompareTag("Mario"); if (isMario) { if (gameObject.tag == "Coin") { CounterManager.addScore(100); CounterManager.addCoin(); } else if (gameObject.tag == "MushroomItem") { CounterManager.addScore(300); } KillObject(); } }