/// <summary> /// Called when [trigger enter]. /// </summary> /// <param name="other">The other.</param> void OnTriggerEnter(Collider other) { // if the collision is with a pickup. Dispatch the points. if (other.gameObject.tag == Enums.CollisionType.Pickup.ToString()) { PlaySound(Enums.CollisionType.Pickup); Pickup pickup = other.gameObject.GetComponent <Pickup>(); pickup.Collided(); int points = pickup.points; if (eventPickupCollision != null) { eventPickupCollision(points); } } else if (other.gameObject.tag == Enums.CollisionType.Obstacle.ToString()) { PlaySound(Enums.CollisionType.Obstacle); if (eventObstacleCollision != null) { eventObstacleCollision(_playerDamage); } // disable the other collider - looks funny but continues the game. other.enabled = false; _playerBloodEmitter.Emit(other.gameObject); } }