SuperTuxKart
Loading...
Searching...
No Matches
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.
 
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.
 
virtual void update (int ticks)
 Updates the timer, and if it expires, the kart animation will be removed from the kart and this object will be deleted.
 
virtual void updateGraphics (float dt)
 
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.
 
virtual KartAnimationType getAnimationType () const =0
 
void handleResetRace ()
 
virtual void saveState (BareNetworkString *buffer)
 
virtual void restoreState (BareNetworkString *buffer)
 

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.
 
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.
 

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.
 
Vec3 m_curr_rotation
 The kart's current rotation.
 
Vec3 m_add_rotation
 The artificial rotation to toss the kart around.
 
float m_velocity
 The velocity with which the kart is moved.
 
int m_reset_ticks
 If not -1, when > world count up ticks it will use m_reset_trans below for animation.
 
btTransform m_reset_trans
 Used for reset kart back to flag base in CTF.
 
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.
 
int m_end_ticks
 Time in ticks for the animation which ends in world count up ticks.
 
int m_created_ticks
 Time in ticks for the animation creation.
 
btTransform m_created_transform
 Transformation by the time the animation was created, used for rewind to recreate the animation with the same one.
 
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)
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.

◆ create() [2/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.

◆ getAnimationType()

virtual KartAnimationType ExplosionAnimation::getAnimationType ( ) const
inlinevirtual

Implements AbstractKartAnimation.

◆ restoreState()

void ExplosionAnimation::restoreState ( BareNetworkString buffer)
virtual

Reimplemented from AbstractKartAnimation.

◆ saveState()

void ExplosionAnimation::saveState ( BareNetworkString buffer)
virtual

Reimplemented from AbstractKartAnimation.

◆ update()

void ExplosionAnimation::update ( int  ticks)
virtual

Updates the kart animation.

Parameters
ticksNumber of time steps - should be 1.

Reimplemented from AbstractKartAnimation.

◆ updateGraphics()

void ExplosionAnimation::updateGraphics ( float  dt)
virtual

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.


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