31 m_cooldownSeconds = 0.25;
38 virtual void Update(
const GameTime *pGameTime)
40 if (m_cooldown > 0) m_cooldown -= pGameTime->GetTimeElapsed();
55 m_cooldown = m_cooldownSeconds;
67 virtual bool CanFire()
const {
return m_cooldown <= 0; }
82 float m_cooldownSeconds;
Used to recycle projectiles.
Definition: ProjectilePool.h:20
A weapon type that shoots.
Definition: Gun.h:21
virtual bool IsActive() const
Determines if the weapon is active.
Definition: Weapon.h:69
Defines how different types of weapons should be triggered.
Definition: TriggerType.h:20
virtual void SetCooldownSeconds(const float seconds)
Sets the time in seconds that the weapon takes between firing.
Definition: Gun.h:71
Shooter Library is a library of classes, interfaces, and value types that provides a foundation for d...
Definition: Background.h:16
virtual void Activate(const Vector2 &position, bool wasShotByPlayer=true)
Activates the projectile.
Definition: Projectile.cpp:58
virtual Vector2 GetPosition() const
Gets the weapon's position.
Definition: Weapon.h:80
virtual TriggerType GetTriggerType() const
Gets the action that triggers the weapon.
Definition: Weapon.h:76
Projectile * GetInactiveProjectile()
Get the next available projectile.
Definition: ProjectilePool.h:54
bool Contains(const TriggerType &type)
Determines if the trigger type contains another trigger type.
Definition: TriggerType.h:136
virtual void ResetCooldown()
Instantly cools the weapon, making it ready to fire.
Definition: Gun.h:74
Base class for all Weapons.
Definition: Weapon.h:19
Base class for all projectile types.
Definition: Projectile.h:20
Gun(const bool isActive)
Instantiates a new weapon object.
Definition: Gun.h:28
virtual bool CanFire() const
Determines if the weapon is ready to fire.
Definition: Gun.h:67
virtual void Update(const GameTime *pGameTime)
Called when the game determines it is time to draw a frame.
Definition: Gun.h:38
virtual void SetProjectilePool(ProjectilePool *pPool)
Sets the pool where the weapon gets it's projectiles.
Definition: Gun.h:63
virtual void Fire(TriggerType triggerType)
Fires the weapon.
Definition: Gun.h:45