ShootComponent.ixx File
Component for handling projectile shooting mechanics. More...
Included Headers
#include <cassert>
#include <helios.engine.modules.spatial.transform.components.ComposeTransformComponent>
#include <helios.engine.mechanics.combat.components.Aim2DComponent>
#include <helios.engine.ecs.GameObject>
#include <helios.engine.core.data.ComponentTypeId>
#include <helios.math>
Namespaces Index
| namespace | helios |
| namespace | engine |
|
Main engine module aggregating core infrastructure and game systems. More... | |
| namespace | mechanics |
|
High-level gameplay systems and components for game logic. More... | |
| namespace | combat |
|
Combat-related gameplay systems, components, and commands. More... | |
| namespace | components |
|
Combat-specific components for aiming, shooting, and attack tracking. More... | |
Classes Index
| class | ShootComponent |
|
Component for handling projectile shooting with rate limiting. More... | |
Description
Component for handling projectile shooting mechanics.
File Listing
The file content with the documentation metadata removed is:
19export namespace helios::engine::mechanics::combat::components {
38 class ShootComponent{
48 float intensity_ = 0.0f;
56 float cooldownDelta_ = 0.0f;
64 float cooldownTimer_ = 0.0f;
70 float projectileSpeed_ = 60.0f;
88 bool isEnabled_ = true;
98 return isEnabled_;
105 isEnabled_ = true;
112 isEnabled_ = false;
118 ShootComponent() = default;
120 ShootComponent(const ShootComponent&) = default;
121 ShootComponent& operator=(const ShootComponent&) = default;
122 ShootComponent(ShootComponent&&) noexcept = default;
123 ShootComponent& operator=(ShootComponent&&) noexcept = default;
137 if (intensity <= helios::math::EPSILON_LENGTH) {
138 intensity_ = 0.0f;
141 sourceVelocity_ = sourceVelocity;
142 intensity_ = intensity;
151 [[nodiscard]] float cooldownDelta() const noexcept {
152 return cooldownDelta_;
161 return intensity_;
169 [[nodiscard]] float cooldownTimer() const noexcept {
170 return cooldownTimer_;
178 void setCooldownTimer(float cooldown) noexcept {
179 cooldownTimer_ = cooldown;
187 void updateCooldownTimerBy(float delta) noexcept {
188 cooldownTimer_ += delta;
196 [[nodiscard]] float projectileSpeed() const noexcept {
197 return projectileSpeed_;
205 void setProjectileSpeed(float speed) noexcept {
206 projectileSpeed_ = speed;
215 [[nodiscard]] helios::math::vec3f sourceVelocity() const noexcept {
216 return sourceVelocity_;
225 return fireRate_;
235 void setFireRate(const float fireRate) noexcept {
236 assert(fireRate > helios::math::EPSILON_LENGTH);
239 cooldownDelta_ = 1.0f/fireRate_;
Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.