#pragma once #include "ShotBase.h" namespace Jazz2::Actors::Weapons { /** @brief Bouncer (shot) Elastic projectile that ricochets off walls, floors and ceilings while affected by gravity, bouncing around until its lifetime expires or it has bounced too many times. The powered-up variant lives longer and gradually steers its horizontal speed toward a target velocity. */ class BouncerShot : public ShotBase { DEATH_RUNTIME_OBJECT(ShotBase); public: /** @brief Creates a new instance */ BouncerShot(); /** @brief Called when the shot is fired */ void OnFire(const std::shared_ptr& owner, Vector2f gunspotPos, Vector2f speed, float angle, bool isFacingLeft); WeaponType GetWeaponType() override { return WeaponType::Bouncer; } protected: Task OnActivatedAsync(const ActorActivationDetails& details) override; void OnUpdate(float timeMult) override; void OnEmitLights(SmallVectorImpl& lights) override; bool OnPerish(ActorBase* collider) override; void OnHitWall(float timeMult) override; void OnHitFloor(float timeMult) override; void OnHitCeiling(float timeMult) override; void OnRicochet() override; private: Vector2f _gunspotPos; std::int32_t _fired; float _targetSpeedX; float _hitLimit; }; }