Space Fighter
A "shmup" game for Computer Programming C++
Loading...
Searching...
No Matches
Blaster Class Reference

Represents a blaster weapon that can be fired by a game object. More...

#include <Blaster.h>

Inheritance diagram for Blaster:

Public Member Functions

 Blaster (const std::string &key)
 Instantiate a blaster object.
 
virtual ~Blaster ()
 
virtual void Update (const GameTime &gameTime)
 Update the blaster.
 
virtual bool CanFire () const
 Check if the blaster is ready to fire.
 
virtual void ResetCooldown ()
 Reset the cooldown of the blaster.
 
virtual float GetCooldownSeconds ()
 Get the number of seconds the blaster must wait between shots.
 
virtual void SetCooldownSeconds (const float seconds)
 Set the number of seconds the blaster must wait between shots.
 
virtual void Fire (TriggerType triggerType)
 Fire the blaster.
 
- Public Member Functions inherited from Weapon
 Weapon (const std::string &key, bool isAttachedToPlayer=true, bool isActive=true, TriggerType triggerType=TriggerType::Primary)
 Instantiate a weapon object.
 
virtual ~Weapon ()
 
virtual void Draw (SpriteBatch &spriteBatch)
 Render the weapon.
 
virtual void SetTriggerType (TriggerType triggerType)
 Set the game object that the weapon is attached to.
 
virtual void SetProjectilePool (std::vector< Projectile * > *pProjectiles)
 Set the pool of projectiles that the weapon can fire.
 
virtual void Activate ()
 Activate the weapon.
 
virtual void Dectivate ()
 Deactivate the weapon.
 
virtual bool IsActive () const
 Determine if the weapon is active.
 
virtual void SetFireSound (AudioSample *pSound)
 Set the sound that will be played when the weapon is fired.
 
virtual AudioSampleGetFireSound ()
 Get the sound that will be played when the weapon is fired.
 
virtual bool IsAttachedToPlayer () const
 Determine if the weapon is attached to the player.
 
virtual void AttachTo (IAttachable *pAttachable, Vector2 &position)
 Attach the weapon to a game object.
 
virtual std::string GetKey () const
 
virtual std::string GetAttachmentType () const
 

Additional Inherited Members

- Protected Member Functions inherited from Weapon
virtual TriggerType GetTriggerType () const
 Get the game object that the weapon is attached to.
 
virtual Vector2 GetPosition () const
 Get the screen position of the weapon.
 
virtual ProjectileGetProjectile ()
 Get a projectile from the pool.
 

Detailed Description

Represents a blaster weapon that can be fired by a game object.

Definition at line 7 of file Blaster.h.

Constructor & Destructor Documentation

◆ Blaster()

Blaster::Blaster ( const std::string & key)
inline

Instantiate a blaster object.

Parameters
isActiveA flag to determine if the weapon is active.

Definition at line 14 of file Blaster.h.

◆ ~Blaster()

virtual Blaster::~Blaster ( )
inlinevirtual

Definition at line 15 of file Blaster.h.

Member Function Documentation

◆ CanFire()

virtual bool Blaster::CanFire ( ) const
inlinevirtual

Check if the blaster is ready to fire.

Returns
True if the blaster is ready to fire.

Definition at line 26 of file Blaster.h.

◆ Fire()

virtual void Blaster::Fire ( TriggerType triggerType)
inlinevirtual

Fire the blaster.

Parameters
triggerTypeThe type of trigger that fired the weapon.
Remarks
If the triggerType doesn't match that of the Blaster, the command will be ignored.

Implements Weapon.

Definition at line 42 of file Blaster.h.

◆ GetCooldownSeconds()

virtual float Blaster::GetCooldownSeconds ( )
inlinevirtual

Get the number of seconds the blaster must wait between shots.

Returns
The number of seconds the blaster must wait between shots.

Definition at line 33 of file Blaster.h.

◆ ResetCooldown()

virtual void Blaster::ResetCooldown ( )
inlinevirtual

Reset the cooldown of the blaster.

Definition at line 29 of file Blaster.h.

◆ SetCooldownSeconds()

virtual void Blaster::SetCooldownSeconds ( const float seconds)
inlinevirtual

Set the number of seconds the blaster must wait between shots.

Parameters
secondsThe number of seconds the blaster must wait between shots.

Definition at line 37 of file Blaster.h.

◆ Update()

virtual void Blaster::Update ( const GameTime & gameTime)
inlinevirtual

Update the blaster.

Parameters
gameTimeA reference to the game time object.

Reimplemented from Weapon.

Definition at line 19 of file Blaster.h.


The documentation for this class was generated from the following file: