namespace systems {
class BasicRandomEnnemiesSystem : public ISystems {
public:
void createNewProjectile(
Registry &r,
const ecs::component::Position &ennemiesPos,
std::shared_ptr<IContext> &ctx
);
void createNewEnnemies(Registry &r, std::shared_ptr<IContext> &ctx);
int nbOfBasicEnnemies(Registry &r);
void shootRandomly(Registry &r, ecs::component::Position &enemyPos, std::shared_ptr<IContext> &ctx);
void operator()(Registry &, std::shared_ptr<IContext> ctx) override;
private:
Clock _clock;
Clock _shootingClock;
};
}; // namespace systems
createNewProjectile:
Spawns a new projectile at the given enemy's position.
Registry: Holds entities and components related to the projectile.ennemiesPos: The position of the enemy where the projectile is spawned.IContext: Context for additional game state (e.g., projectile settings).createNewEnnemies:
Creates new enemies in the game world.
Registry: Manages entities and components related to enemies.IContext: Game context for enemy attributes.nbOfBasicEnnemies:
Returns the number of basic enemies currently in the game.
Registry: Holds and tracks enemy entities.shootRandomly:
Randomly triggers shooting actions from enemies.
Registry: Manages entities and components.enemyPos: The position from which the enemy shoots.IContext: Provides game state context.operator():
Updates the enemy behavior and shooting logic each game cycle.
_clock:
Manages enemy creation timing.
_shootingClock:
Tracks intervals between random enemy shots.