SuperTuxKart
Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
ProjectileManager Class Reference
Inheritance diagram for ProjectileManager:
Inheritance graph
[legend]

Public Member Functions

void loadData ()
 
void cleanup ()
 
void update (int ticks)
 General projectile update call. More...
 
void updateGraphics (float dt)
 Called once per rendered frame. More...
 
void removeTextures ()
 
bool projectileIsClose (const AbstractKart *const kart, float radius)
 Returns true if a projectile is within the given distance of the specified kart. More...
 
int getNearbyProjectileCount (const AbstractKart *const kart, float radius, PowerupManager::PowerupType type, bool exclude_owned=false)
 Returns an int containing the numbers of a given flyable in a given radius around the kart. More...
 
void addHitEffect (HitEffect *hit_effect)
 Adds a special hit effect to be shown. More...
 
std::shared_ptr< RewinderaddRewinderFromNetworkState (const std::string &uid)
 
std::shared_ptr< FlyablenewProjectile (AbstractKart *kart, PowerupManager::PowerupType type)
 Creates a new projectile of the given type. More...
 
void addByUID (const std::string &uid, std::shared_ptr< Flyable > f)
 
void removeByUID (const std::string &uid)
 

Private Types

typedef std::vector< HitEffect * > HitEffects
 

Private Member Functions

std::string getUniqueIdentity (AbstractKart *kart, PowerupManager::PowerupType type)
 
void updateServer (int ticks)
 Updates all rockets on the server (or no networking). More...
 

Private Attributes

std::map< std::string, std::shared_ptr< Flyable > > m_active_projectiles
 The list of all active projectiles, i.e. More...
 
HitEffects m_active_hit_effects
 All active hit effects, i.e. More...
 

Member Function Documentation

◆ addHitEffect()

void ProjectileManager::addHitEffect ( HitEffect hit_effect)
inline

Adds a special hit effect to be shown.

Parameters
hit_effectThe hit effect to be added.

◆ getNearbyProjectileCount()

int ProjectileManager::getNearbyProjectileCount ( const AbstractKart *const  kart,
float  radius,
PowerupManager::PowerupType  type,
bool  exclude_owned = false 
)

Returns an int containing the numbers of a given flyable in a given radius around the kart.

Parameters
kartThe kart for which the test is done.
radiusDistance within which the projectile must be.
typeThe type of projectile checked

◆ newProjectile()

std::shared_ptr< Flyable > ProjectileManager::newProjectile ( AbstractKart kart,
PowerupManager::PowerupType  type 
)

Creates a new projectile of the given type.

Parameters
kartThe kart which shoots the projectile.
typeType of projectile.

◆ projectileIsClose()

bool ProjectileManager::projectileIsClose ( const AbstractKart *const  kart,
float  radius 
)

Returns true if a projectile is within the given distance of the specified kart.

Parameters
kartThe kart for which the test is done.
radiusDistance within which the projectile must be.

◆ update()

void ProjectileManager::update ( int  ticks)

General projectile update call.

◆ updateGraphics()

void ProjectileManager::updateGraphics ( float  dt)

Called once per rendered frame.

It is used to only update any graphical effects, and calls updateGraphics in any flyable objects.

Parameters
dtTime step size (since last call).

◆ updateServer()

void ProjectileManager::updateServer ( int  ticks)
private

Updates all rockets on the server (or no networking).

Member Data Documentation

◆ m_active_hit_effects

HitEffects ProjectileManager::m_active_hit_effects
private

All active hit effects, i.e.

hit effects which are currently being shown or have a sfx playing.

◆ m_active_projectiles

std::map<std::string, std::shared_ptr<Flyable> > ProjectileManager::m_active_projectiles
private

The list of all active projectiles, i.e.

projectiles which are currently moving on the track.


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