This Component allow to execute an action at every frame for a specified time.
More...
#include <Component.hpp>
|
| void | updateTick (const float ¤tTime) |
| | Updates the current state of the animation by calling the callback. It uses a startTime and a currentTime allowing to stop the action after specified time.
|
| | TimeAnimation (const float &startTime, const float &timeToLive, std::function< void()> &&func) |
| | Instances an animation that will live timeToLive seconds after it has been created startTime and at every frame is needed to execute the callback.
|
|
|
std::function< void()> | func {} |
| | callback function
|
|
float | startTime |
| | start time of the animation
|
|
float | timeToLive |
| | duration of the animation
|
|
bool | dead = false |
| | determines if the animation is finished, if it's true the callback will be called
|
This Component allow to execute an action at every frame for a specified time.
- Note
- TimeAnimation::updateTick() must be called at every frame to work.
◆ TimeAnimation()
| TimeAnimation::TimeAnimation |
( |
const float & | startTime, |
|
|
const float & | timeToLive, |
|
|
std::function< void()> && | func ) |
|
inline |
Instances an animation that will live timeToLive seconds after it has been created startTime and at every frame is needed to execute the callback.
- Parameters
-
| startTime | the time when animation starts |
| timeToLive | the duration in seconds of the animation |
| func | the animation action |
◆ updateTick()
| void TimeAnimation::updateTick |
( |
const float & | currentTime | ) |
|
|
inline |
Updates the current state of the animation by calling the callback. It uses a startTime and a currentTime allowing to stop the action after specified time.
- Parameters
-
The documentation for this class was generated from the following file: