/** * \brief This function is called when a crystal detects a collision with this entity. * \param crystal the crystal * \param collision_mode the collision mode that detected the event */ void Arrow::notify_collision_with_crystal(Crystal& crystal, CollisionMode collision_mode) { if (collision_mode == COLLISION_OVERLAPPING && is_flying()) { crystal.activate(*this); attach_to(crystal); } }
/** * \brief This function is called when a crystal detects a collision with this entity. * \param crystal the crystal * \param collision_mode the collision mode that detected the event */ void Boomerang::notify_collision_with_crystal(Crystal &crystal, CollisionMode collision_mode) { if (collision_mode == COLLISION_RECTANGLE) { crystal.activate(*this); if (!is_going_back()) { go_back(); } } }
/** * \brief This function is called when a crystal detects a collision with this entity. * \param crystal the crystal * \param collision_mode the collision mode that detected the event */ void CarriedItem::notify_collision_with_crystal(Crystal& crystal, CollisionMode collision_mode) { if (collision_mode == COLLISION_OVERLAPPING && is_being_thrown() && !can_explode()) { crystal.activate(*this); break_item(); } }
/** * @brief This function is called when a crystal detects a collision with this entity. * @param crystal the crystal * @param collision_mode the collision mode that detected the event */ void Hookshot::notify_collision_with_crystal(Crystal& crystal, CollisionMode collision_mode) { if (is_flying()) { crystal.activate(*this); if (!is_going_back()) { go_back(); } } }
/** * \brief This function is called when a the sprite of a crystal * detects a pixel-precise collision with a sprite of this entity. * \param crystal the crystal * \param sprite_overlapping the sprite of the current entity that collides with the crystal */ void Explosion::notify_collision_with_crystal(Crystal& crystal, Sprite& /* sprite_overlapping */) { crystal.activate(*this); }