SuperTuxKart
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
ExplosionAnimation Class Reference

This class is a 'mixin' for kart, and handles the animated explosion. More...

#include <explosion_animation.hpp>

Inheritance diagram for ExplosionAnimation:
Inheritance graph
[legend]

Public Member Functions

virtual void update (int ticks)
 Updates the kart animation. More...
 
virtual void updateGraphics (float dt)
 
virtual KartAnimationType getAnimationType () const
 
virtual void saveState (BareNetworkString *buffer)
 
virtual void restoreState (BareNetworkString *buffer)
 
bool hasResetAlready () const
 
- Public Member Functions inherited from AbstractKartAnimation
 AbstractKartAnimation (AbstractKart *kart, const std::string &name)
 Constructor. More...
 
virtual float getAnimationTimer () const
 Returns the current animation timer.
 
virtual const std::string & getName () const
 To easily allow printing the name of the animation being used atm. More...
 
void handleResetRace ()
 

Static Public Member Functions

static ExplosionAnimationcreate (AbstractKart *kart, const Vec3 &pos, bool direct_hit)
 A static create function that does only create an explosion if the explosion happens to be close enough to affect the kart. More...
 
static ExplosionAnimationcreate (AbstractKart *kart)
 A static create function that does only create an explosion if the explosion happens to be close enough to affect the kart. More...
 

Protected Member Functions

void restoreData (BareNetworkString *b)
 
void init (bool direct_hit, const Vec3 &normal, const btTransform &reset_trans)
 
 ExplosionAnimation (AbstractKart *kart, BareNetworkString *buffer)
 
 ExplosionAnimation (AbstractKart *kart, bool direct_hit)
 
- Protected Member Functions inherited from AbstractKartAnimation
void resetPowerUp ()
 In CTF mode call this to reset kart powerup when get hit.
 
void restoreBasicState (BareNetworkString *buffer)
 Used in constructor of sub-class as no virtual function can be used there.
 
float getMaximumHeight (const Vec3 &up_vector, float height_remove)
 Determine maximum rescue height with up-raycast.
 

Protected Attributes

Vec3 m_normal
 The normal of kart when it started to explode. More...
 
Vec3 m_curr_rotation
 The kart's current rotation. More...
 
Vec3 m_add_rotation
 The artificial rotation to toss the kart around. More...
 
float m_velocity
 The velocity with which the kart is moved. More...
 
int m_reset_ticks
 If not -1, when > world count up ticks it will use m_reset_trans below for animation. More...
 
btTransform m_reset_trans
 Used for reset kart back to flag base in CTF. More...
 
int m_reset_trans_compressed [4]
 
bool m_direct_hit
 
- Protected Attributes inherited from AbstractKartAnimation
AbstractKartm_kart
 A pointer to the kart which is animated by this class. More...
 
int m_end_ticks
 Time in ticks for the animation which ends in world count up ticks. More...
 
int m_created_ticks
 Time in ticks for the animation creation. More...
 
btTransform m_created_transform
 Transformation by the time the animation was created, used for rewind to recreate the animation with the same one. More...
 
int m_created_transform_compressed [4]
 

Friends

class KartRewinder
 

Detailed Description

This class is a 'mixin' for kart, and handles the animated explosion.

I.e. it will throw the kart a certain amount in the air, rotate it randomly, and after the specified time period let it land at the same spot where it was hit, therefore avoiding any problems of karts being pushed on wrong parts of the track, and making explosion more 'fair' (it can't happen that one explosion give you actually a benefit by pushing you forwards. The object is a base class for kart, but will only be used if an explosion happens.

Member Function Documentation

◆ create() [1/2]

ExplosionAnimation * ExplosionAnimation::create ( AbstractKart kart,
const Vec3 pos,
bool  direct_hit 
)
static

A static create function that does only create an explosion if the explosion happens to be close enough to affect the kart.

Otherwise, NULL is returned.

Parameters
kartThe kart that is exploded.
posThe position where the explosion happened.
direct_hitIf the kart was hit directly.

◆ create() [2/2]

ExplosionAnimation * ExplosionAnimation::create ( AbstractKart kart)
static

A static create function that does only create an explosion if the explosion happens to be close enough to affect the kart.

Otherwise, NULL is returned.

◆ update()

void ExplosionAnimation::update ( int  ticks)
virtual

Updates the kart animation.

Parameters
ticksNumber of time steps - should be 1.

Reimplemented from AbstractKartAnimation.

Member Data Documentation

◆ m_add_rotation

Vec3 ExplosionAnimation::m_add_rotation
protected

The artificial rotation to toss the kart around.

It's in units of rotation per second.

◆ m_curr_rotation

Vec3 ExplosionAnimation::m_curr_rotation
protected

The kart's current rotation.

◆ m_normal

Vec3 ExplosionAnimation::m_normal
protected

The normal of kart when it started to explode.

◆ m_reset_ticks

int ExplosionAnimation::m_reset_ticks
protected

If not -1, when > world count up ticks it will use m_reset_trans below for animation.

◆ m_reset_trans

btTransform ExplosionAnimation::m_reset_trans
protected

Used for reset kart back to flag base in CTF.

◆ m_velocity

float ExplosionAnimation::m_velocity
protected

The velocity with which the kart is moved.


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