|
Tiberian Technologies Scripts Reference Revision: 9000
|
Controller for looped animations using a subset of frames. More...
#include <LoopedAnimationController.h>
Public Member Functions | |
| LoopedAnimationController (GameObject *pObj) | |
| ~LoopedAnimationController () | |
| void | PlayAnimation (const char *animation, int startFrame, int endFrame, int nRepetitions=0) |
| void | StopAnimation () |
This class is designed to be a generic controller that can be dropped into a script to control looping animations that do not use the entire set of frames within an animation. By default the animation subsystem in the Renegade engine does not support this functionality and previously the code in this class was duplicated across several scripts that required it.
It works by attaching itself as a listener on the object being animated, thus causing the Animation_Complete function to be called each time the object completes an animation from a start frame to an end frame. It can then restart that animation from the start frame again, thus creating a looping animation.
| LoopedAnimationController::LoopedAnimationController | ( | GameObject * | pObj | ) |
Class constructor - adds itself as a listener to the specified object
| [in] | pObj | The GameObject upon which we want to control looping animations |
| LoopedAnimationController::~LoopedAnimationController | ( | ) |
Class destructor - removes itself as a listener if the object still exists
| void LoopedAnimationController::PlayAnimation | ( | const char * | animation, |
| int | startFrame, | ||
| int | endFrame, | ||
| int | nRepetitions = 0 ) |
Start playing a looped animation on the object we are listening to
| [in] | animation | Name of the animation to play |
| [in] | startFrame | First frame number within the animation to be played |
| [in] | endFrame | Final frame number within the animation to be played, before looping back to startFrame |
| [in] | nRepetitions | Optional number of repetitions to play before stopping the animation, or 0 to loop indefinitely |
| void LoopedAnimationController::StopAnimation | ( | ) |
Stop the currently playing looped animation on the object, if any