26 virtual bool CanFire()
const {
return m_cooldown <= 0; }
49 if (!pProjectile)
return;
52 if (pAudio) pAudio->
Play();
55 m_cooldown = m_cooldownSeconds;
62 float m_cooldownSeconds = 0.35;
Represents a blaster weapon that can be fired by a game object.
virtual void Update(const GameTime &gameTime)
Update the blaster.
Blaster(const std::string &key)
Instantiate a blaster object.
virtual void SetCooldownSeconds(const float seconds)
Set the number of seconds the blaster must wait between shots.
virtual void ResetCooldown()
Reset the cooldown of the blaster.
virtual bool CanFire() const
Check if the blaster is ready to fire.
virtual float GetCooldownSeconds()
Get the number of seconds the blaster must wait between shots.
virtual void Fire(TriggerType triggerType)
Fire the blaster.
Represents a 2D grid of texels.
Contains timing values for game updates and rendering.
double GetElapsedTime() const
Gets the time in seconds since last frame.
Represents a projectile that can be fired by a weapon.
virtual void Activate(const Vector2 &position, bool wasShotByPlayer=true)
Activate the projectile.
Represents a type of trigger, which can be used to activate weapons.
bool Contains(const TriggerType &type) const
Check if the trigger type contains a specific trigger.
Base class for all weapons that can be fired by a game object.
virtual bool IsAttachedToPlayer() const
Determine if the weapon is attached to the player.
virtual TriggerType GetTriggerType() const
Get the game object that the weapon is attached to.
virtual AudioSample * GetFireSound()
Get the sound that will be played when the weapon is fired.
virtual Vector2 GetPosition() const
Get the screen position of the weapon.
virtual Projectile * GetProjectile()
Get a projectile from the pool.
virtual bool IsActive() const
Determine if the weapon is active.