FYP  1.0.0
Final Year Project -- Alexander Meuer
abilities::MagicMisile Class Reference
Inheritance diagram for abilities::MagicMisile:
Inheritance graph
Collaboration diagram for abilities::MagicMisile:
Collaboration graph

Public Member Functions

 MagicMisile (tinyxml2::XMLElement *xml)
 
- Public Member Functions inherited from Ability
 Ability (tinyxml2::XMLElement *xml)
 Constructs an Ability from xml. Only description is read from xml in this base class, derived classes will require more. More...
 
virtual void execute (Pawn *user)
 Calls doExecuteLogic() if ability has fully cooled since last use. More...
 
void update (sf::Time const &elapsedTime)
 Checks if ability is active and does update logic if it is. More...
 
const std::string & getDescription () const
 Gets a user-friendly description of the ability, as it might appear in a tooltip, etc. More...
 
const std::string & getName () const
 Gets the user-friendly name of the ability. More...
 
bool canCast () const
 
float getRemainingCooldown () const
 Gets the remaining time, in seconds, before the ability can be used again.
 
float getTotalCooldown () const
 The time, in seconds, that the ability's cooldown lasts.
 
sf::Time const & getCastDuration () const
 
bool isActive () const
 Gets whether the ability has been activated or not. More...
 
void setPawnList (std::shared_ptr< const std::list< std::shared_ptr< Pawn >>> const &list)
 Sets the pawn list to be used when the Ability wishes to find pawns in the game. The pawn list cannot be used for directly adding Pawns to the game. More...
 
void setProjectileManager (std::shared_ptr< ProjectileManager > const &manager)
 Sets the ProjectileManager to be used when the Ability wishes to add projectiles to the game. More...
 
void setSpawnCallback (std::function< void(std::shared_ptr< Minion >)> const &callback)
 Sets the callback used for adding units to the game. Adding a unit to the pawn list won't add flocking or collision, so we've a callback that will. More...
 
bool checkHotkey (char key) const
 
char getHotkey () const
 
void setHotkey (char hotkey)
 

Protected Member Functions

void doExecuteLogic (Pawn *user) override
 Launches homing projectiles that target enemies. More...
 
void doUpdateLogic (sf::Time const &deltaTime) override
 Animates the ability graphics and spawns missiles. The missiles are spawned throughout the cast time and are given random initial velocities. More...
 
void doDraw (sf::RenderTarget &target, sf::RenderStates states) const override
 Draws the ability graphics.
 
- Protected Member Functions inherited from Ability
void activate ()
 
void deactivate ()
 
void draw (sf::RenderTarget &target, sf::RenderStates states) const override final
 Calls doDraw() if ability is active.
 
void spawnMinion (std::shared_ptr< Minion > const &pawn) const
 Adds a Pawn to the game. More...
 
void spawnProjectile (std::shared_ptr< Projectile > const &projectile) const
 Adds a projectile to the game. More...
 

Private Attributes

const unsigned int M_NUM_MISSILES
 The number of missiles to spawn.
 
Damage::Type mDamageType
 The type of damage the missiles will deal.
 
const float M_MISSILE_DAMAGE
 The amount of damage each missile will deal.
 
unsigned int mMissilesSpawned
 How many missiles have been spawned so far since execute().
 
float mMissileSpawnInterval
 
float mTimeSinceMissileSpawn
 
Actor mCastGraphics
 
sf::Sound mLaunchSound
 

Member Function Documentation

void abilities::MagicMisile::doExecuteLogic ( Pawn user)
overrideprotectedvirtual

Launches homing projectiles that target enemies.

Parameters
Theuser of this ability. Ownership is not gained and the pointer is not stored.

Implements Ability.

void abilities::MagicMisile::doUpdateLogic ( sf::Time const &  deltaTime)
overrideprotectedvirtual

Animates the ability graphics and spawns missiles. The missiles are spawned throughout the cast time and are given random initial velocities.

Parameters
deltaSecondsThe time since the last update loop iteration.

Implements Ability.


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