SuperTuxKart
|
The base class for all kart animation, like rescue, explosion, or cannon. More...
#include <abstract_kart_animation.hpp>
Public Member Functions | |
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) |
Protected Member Functions | |
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 | |
AbstractKart * | m_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] |
Private Attributes | |
std::string | m_name |
Name of this animation, used for debug prints only. | |
The base class for all kart animation, like rescue, explosion, or cannon.
Kart animations are done by removing the physics body from the physics world, and instead modifying the rotation and position of the kart directly. They are registered with the kart, and only one can be used at the same time. The memory is handled by the kart object, so there is no need to manage it. Sample usage: new ExplosionAnimation(kart); The object does not need to be stored.
AbstractKartAnimation::AbstractKartAnimation | ( | AbstractKart * | kart, |
const std::string & | name | ||
) |
Constructor.
Note that kart can be NULL in case that the animation is used for a basket ball in a cannon animation.
kart | Pointer to the kart that is animated, or NULL if the the animation is meant for a basket ball etc. |
|
inlinevirtual |
To easily allow printing the name of the animation being used atm.
Used in AstractKart in case of an incorrect sequence of calls.
|
virtual |
Updates the timer, and if it expires, the kart animation will be removed from the kart and this object will be deleted.
NOTE: calling this function must be the last thing done in any kart animation class, since this object might be deleted, so accessing any members might be invalid.
ticks | Number of time steps - should be 1. |
Reimplemented in CannonAnimation, ExplosionAnimation, and RescueAnimation.