16 if (playerEntities.empty())
20 auto &[playerEntity, player] = *playerEntities.begin();
23 if ((transform ==
nullptr) || (beamCharge ==
nullptr))
28 bool spacePressed =
false;
29 if (!keyboardEntities.empty())
31 auto &[keyboardEntity, keyboardInput] = *keyboardEntities.begin();
42 beamCharge->current_charge = std::min(beamCharge->current_charge, beamCharge->max_charge);
43 if (beamCharge->current_charge < beamCharge->max_charge)
58 beamCharge->current_charge = 0.0f;
66 const auto &entity : loadingEntities | std::views::keys)
94 std::vector<ecs::Entity> toRemove;
96 for (
const auto &entity : loadingEntities | std::views::keys)
98 toRemove.push_back(entity);
101 for (
const auto entity : toRemove)
133 m_superShotAudioEntity =
Configuration constants for the multiplayer game.
Weapon system for R-Type multiplayer client.
EntityBuilder & with(Args &&...args)
Class for managing entities and their components.
EntityBuilder createEntity()
bool hasComponent(Entity e)
std::unordered_map< Entity, T > & getAll()
T * getComponent(Entity e)
void removeComponent(Entity e)
static void hideLoadingAnimation(ecs::Registry ®istry, ecs::Entity playerEntity)
Hide/remove the charging animation.
static void showLoadingAnimation(ecs::Registry ®istry, ecs::Entity playerEntity, const ecs::Transform *playerTransform)
Display charging/loading animation in front of player.
bool m_isCharging
Whether weapon is currently charging.
void ensureSuperShotAudio(ecs::Registry ®istry)
Ensure super shot audio entity exists.
void update(ecs::Registry ®istry, float dt) override
Update weapon system (called each frame)
float m_fireCooldown
Remaining cooldown time before next shot (seconds)
This file contains common definitions and constants.
constexpr Entity INVALID_ENTITY
constexpr float CHARGE_RATE
constexpr float ANIMATION_DURATION
constexpr int ANIMATION_FRAMES
constexpr float SPRITE_WIDTH
constexpr float SPRITE_HEIGHT
constexpr auto AUDIO_SUPERCHARGED_SHOT
constexpr auto TEXTURE_SHOOT_LOADING