This system manages the behavior of boss entities in the game, including their creation, projectile attacks, and interaction with players.

namespace systems {
        class BossSystems : public ISystems {
          public:
            void operator()(Registry &, std::shared_ptr<IContext> ctx) override;

            void createNewProjectile(
                Registry &r,
                const ecs::component::Position &bossPos,
                std::shared_ptr<IContext> ctx
            );
            void createFirstBoss(Registry &r, std::shared_ptr<IContext> ctx);
            bool isABoss(Registry &r);
            void moveProjectileTowardsPlayer(
                Registry &r,
                ecs::component::Position &projectilePos,
                const std::size_t &idx,
                std::shared_ptr<IContext> ctx
            );

          private:
            ecs::Clock _bossClock;
            ecs::Clock _shootingClock;
            ecs::Clock _projectileClock;
            std::size_t times = 0;
            std::array<std::function<void(Registry &r, std::shared_ptr<IContext> ctx)>, 1> _bosses{
                {[this](Registry &r, std::shared_ptr<IContext> ctx) { createFirstBoss(r, ctx); }},
            };
        };
    } // namespace systems

Methods

Private Members