CG-Project2
Loading...
Searching...
No Matches
TimeAnimation Class Reference

This Component allow to execute an action at every frame for a specified time. More...

#include <Component.hpp>

Inheritance diagram for TimeAnimation:
Collaboration diagram for TimeAnimation:

Public Member Functions

void updateTick (const float &currentTime)
 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.

Public Attributes

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

Detailed Description

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.

Constructor & Destructor Documentation

◆ 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
startTimethe time when animation starts
timeToLivethe duration in seconds of the animation
functhe animation action

Member Function Documentation

◆ 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
currentTime

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