private void OnTriggerEnter(Collider other) { if (other.gameObject.tag == "Player") { Debug.Log("Player Collided with Obstacle"); OnObstacleCollision?.Invoke(); } }
private void OnTriggerEnter2D(Collider2D collision) { if (collision.tag == "Collectible") { //Fire the OnCollectableCollision event OnCollectableCollision?.Invoke(); Destroy(collision.gameObject); } if (collision.tag == "Obstacle") { //Fire the OnObstacleCollision event OnObstacleCollision?.Invoke(); } }