FYP  1.0.0
Final Year Project -- Alexander Meuer
FancyProjectile Class Reference

Projectile that emits particles as it travels and homes in on its target. More...

#include <FancyProjectile.hpp>

Inheritance diagram for FancyProjectile:
Inheritance graph
Collaboration diagram for FancyProjectile:
Collaboration graph

Public Member Functions

 FancyProjectile (int damage, Damage::Type damageType, sf::Texture &texture, int impactRadius=10)
 Constructs a fancy projectile. More...
 
void fire (sf::Vector2f const &from, sf::Vector2f const &to, float flightTimeSeconds) override
 Fires a homing projectile in the opposite direction of the target. The projectiles initial velocity shoots it away from its target, but the projectile then turns around, homing in on its target. More...
 
void update (sf::Time const &elapsedTime) override
 Moves the projectile toward its destination. Moves the projectile and associated emitter toward its destination, accounting for turning circle. More...
 
void setTarget (std::shared_ptr< Pawn > const &newTarget)
 
void attachToParticleSystem (thor::ParticleSystem &system)
 
- Public Member Functions inherited from Projectile
 Projectile (int damage, Damage::Type damageType, sf::Texture &texture, int impactRadius=10)
 
bool isActive () const
 
bool impactOccured () const
 
virtual void onCollide (std::shared_ptr< Collidable > &other, sf::Vector2f const &mtv) override
 
int getDamage () const
 
Damage::Type getDamageType () const
 
- Public Member Functions inherited from Actor
 Actor (sf::Texture &texture, sf::Shape *collisionMask, sf::Vector2f const &maskOffset)
 
 Actor (tinyxml2::XMLElement *xml)
 
void animate (sf::Time const &elapsedTime)
 Updates the animator and applies it to ourself.
 
bool isPlayingAnimation () const
 Returns true if an animation is currently playing.
 
std::string getPlayingAnimation () const
 Gets the name of the playing animation. Undefined behaviour if no animation playing.
 
void playAnimation (std::string const &name, bool loop=false)
 Begins playing an animation by name.
 
void setVisible (bool isVisible=true)
 
bool toggleVisible ()
 
bool getVisible () const
 
virtual void draw (sf::RenderTarget &target) const
 
- Public Member Functions inherited from collision::Collidable
 Collidable (sf::Shape *mask, sf::Vector2f offset)
 
 Collidable (Collidable const &other)
 
 Collidable (tinyxml2::XMLElement *xml)
 Constructs a Collidable from an xml tag. Tag requires pointCoint and type attributes in addition to child tags depending on type specified. More...
 
const sf::Shape * getMask () const
 
void setMask (sf::Shape *mask, sf::Vector2f offset)
 
virtual void onCollide (std::shared_ptr< Collidable > &other, sf::Vector2f const &mtv)
 Called when we collide with something.
 
void setDebugColour (sf::Color const &c)
 
void debug_draw (sf::RenderTarget &target)
 
void getAxies (std::vector< sf::Vector2f > &axiesVector)
 Gets all axies of the mask. Gets all axies of the mask. Currently inefficient due to the fact that it iterates over all points and returns all axies (a duplicate of each axis is included!). More...
 
size_t getPointCount () const
 Gets the number of points in the mask. Calls mask->getPoint() and returns the result.
 
sf::Vector2f projectOntoAxis (sf::Vector2f &axis) const
 Projects the mask onto an axis. Projects each point of the mask onto an axis and returns the min and max points it covers on that axis. More...
 

Private Attributes

thor::ScopedConnection mConnection
 Connection to a thor::ParticleSystem. Upon destruction, mEmitter will be disconnected.
 
thor::UniversalEmitter mEmitter
 Emitter used to make particles.
 
const float mSpeed
 
const float mTurnSpeed
 How much the projectile can turn (in radians) each update.
 
std::weak_ptr< PawnmTarget
 

Additional Inherited Members

- Protected Member Functions inherited from collision::Collidable
void updateCollidableMask (sf::Vector2f const &newPosition)
 Updates the position of the mask. Updates the position of the mask to equal newPosition plus the offset. More...
 
- Protected Attributes inherited from Projectile
bool mActive
 
sf::Vector2f mVelocity
 
float mTimeToLive
 
bool mImpactOccurred
 
- Protected Attributes inherited from Actor
bool mVisible
 

Detailed Description

Projectile that emits particles as it travels and homes in on its target.

Constructor & Destructor Documentation

FancyProjectile::FancyProjectile ( int  damage,
Damage::Type  damageType,
sf::Texture &  texture,
int  impactRadius = 10 
)

Constructs a fancy projectile.

Parameters
damageThe amount of damage to inflict on impact.
damageTypeThe type of damage in inflict, PHYSICAL or MAGICAL.
textureVisual representation of the projectile.

Member Function Documentation

void FancyProjectile::fire ( sf::Vector2f const &  from,
sf::Vector2f const &  to,
float  flightTimeSeconds 
)
overridevirtual

Fires a homing projectile in the opposite direction of the target. The projectiles initial velocity shoots it away from its target, but the projectile then turns around, homing in on its target.

Parameters
fromThe starting location.
toThe destination location.
Ignoredby this projectile type.

Implements Projectile.

void FancyProjectile::update ( sf::Time const &  elapsedTime)
overridevirtual

Moves the projectile toward its destination. Moves the projectile and associated emitter toward its destination, accounting for turning circle.

Parameters
elapsedTimeHow much time has passed since update() was last called.

Implements Projectile.


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