DayZ 1.24
Loading...
Searching...
No Matches
AnimationTimer Class Reference

AnimationTimer class. This timer is for animating float value.
usage: More...

Inheritance diagram for AnimationTimer:
[legend]
Collaboration diagram for AnimationTimer:
[legend]

Protected Member Functions

void AnimationTimer (int category=CALL_CATEGORY_SYSTEM)
 
void ~AnimationTimer ()
 
void Run (float targetVal, Managed obj, string updateFunc, string finishedFunc, float startingVal=0, bool loop=false, float speed=1.0, Param params=null, int category=CALL_CATEGORY_SYSTEM)
 
float GetValue ()
 Returns actual animated value.
 
override bool IsRunning ()
 
override void Tick (float timeslice)
 Ticks the timer, is called by timer subsystem.
 

Protected Attributes

Managed m_TargetObject
 
string m_UpdateFunction
 
string m_FinishedFunction
 
ref Param m_Params
 

Private Attributes

bool m_Active
 
float m_TargetValue
 
float m_TargetValueOriginal
 
float m_Value
 
- Private Attributes inherited from TimerBase
Managed m_target
 
string m_function
 
ref Param m_params
 

Additional Inherited Members

- Private Member Functions inherited from TimerBase
void Timer (int category=CALL_CATEGORY_SYSTEM)
 
void Run (float duration, Managed obj, string fn_name, Param params=NULL, bool loop=false)
 Starts timer.
 
void OnTimer ()
 
override void Stop ()
 

Detailed Description

AnimationTimer class. This timer is for animating float value.
usage:

class MyObject
{
void MyObject()
{
myAnim.Run(60, this, "Refresh");
}
void Refresh()
{
Print(myAnim.GetValue());
}
};
void Refresh()
AnimationTimer class. This timer is for animating float value. usage:
Definition tools.c:618
proto void Print(void var)
Prints content of variable to console/log.

Definition at line 617 of file tools.c.

Constructor & Destructor Documentation

◆ AnimationTimer()

void AnimationTimer::AnimationTimer ( int category = CALL_CATEGORY_SYSTEM)
inlineprotected

Definition at line 628 of file tools.c.

629 {
631 }
void OnInit()
Definition AIBehaviour.c:49

References OnInit().

◆ ~AnimationTimer()

void AnimationTimer::~AnimationTimer ( )
inlineprotected

Definition at line 633 of file tools.c.

634 {
635 SetRunning(false);
636 }
void SetRunning(bool running)
Definition tools.c:335

References SetRunning().

Member Function Documentation

◆ GetValue()

float AnimationTimer::GetValue ( )
inlineprotected

Returns actual animated value.

Definition at line 656 of file tools.c.

657 {
658 return m_Value;
659 }
float m_Value
Definition tools.c:622

References m_Value.

◆ IsRunning()

override bool AnimationTimer::IsRunning ( )
inlineprotected

Definition at line 661 of file tools.c.

662 {
663 return m_Active;
664 }
bool m_Active
Definition tools.c:619

References m_Active.

◆ Run()

void AnimationTimer::Run ( float targetVal,
Managed obj,
string updateFunc,
string finishedFunc,
float startingVal = 0,
bool loop = false,
float speed = 1.0,
Param params = null,
int category = CALL_CATEGORY_SYSTEM )
inlineprotected

Definition at line 638 of file tools.c.

639 {
640 SetRunning(true);
641 m_TargetObject = obj;
646 m_time = speed;
647 m_loop = loop;
648 m_Active = true;
651 }
string m_UpdateFunction
Definition tools.c:624
float m_TargetValueOriginal
Definition tools.c:621
string m_FinishedFunction
Definition tools.c:625
ref Param m_Params
Definition tools.c:626
float m_TargetValue
Definition tools.c:620
Managed m_TargetObject
Definition tools.c:623
float m_time
Definition tools.c:212
bool m_loop
Definition tools.c:210

References m_Active, m_FinishedFunction, m_loop, m_Params, m_TargetObject, m_TargetValue, m_TargetValueOriginal, m_time, m_UpdateFunction, m_Value, and SetRunning().

◆ Tick()

override void AnimationTimer::Tick ( float timeslice)
inlineprotected

Ticks the timer, is called by timer subsystem.

Definition at line 668 of file tools.c.

669 {
670 if (!m_Active)
671 return;
672
673
675 float step = m_time * timeslice;
676
677 if (diff < step)
678 {
680 if (!m_loop)
681 m_Active = false;
682 else
683 {
685 m_TargetValue = 0;
686 else
688
689 }
690 GetGame().GameScript.CallFunction(m_TargetObject, m_FinishedFunction, NULL, m_Params);
691 }
692 else
693 {
695 m_Value += step;
696 else
697 m_Value -= step;
698 }
699
700 GetGame().GameScript.CallFunction(m_TargetObject, m_UpdateFunction, NULL, m_Params);
701 }
Definition EnMath.c:7
proto native CGame GetGame()
static proto float AbsFloat(float f)
Returns absolute value.

References Math::AbsFloat(), GetGame(), m_Active, m_FinishedFunction, m_loop, m_Params, m_TargetObject, m_TargetValue, m_TargetValueOriginal, m_time, m_UpdateFunction, and m_Value.

Member Data Documentation

◆ m_Active

bool AnimationTimer::m_Active
private

Definition at line 619 of file tools.c.

Referenced by IsRunning(), Run(), and Tick().

◆ m_FinishedFunction

string AnimationTimer::m_FinishedFunction
protected

Definition at line 625 of file tools.c.

Referenced by Run(), and Tick().

◆ m_Params

ref Param AnimationTimer::m_Params
protected

Definition at line 626 of file tools.c.

Referenced by Run(), and Tick().

◆ m_TargetObject

Managed AnimationTimer::m_TargetObject
protected

Definition at line 623 of file tools.c.

Referenced by Run(), and Tick().

◆ m_TargetValue

float AnimationTimer::m_TargetValue
private

Definition at line 620 of file tools.c.

Referenced by Run(), and Tick().

◆ m_TargetValueOriginal

float AnimationTimer::m_TargetValueOriginal
private

Definition at line 621 of file tools.c.

Referenced by Run(), and Tick().

◆ m_UpdateFunction

string AnimationTimer::m_UpdateFunction
protected

Definition at line 624 of file tools.c.

Referenced by Run(), and Tick().

◆ m_Value

float AnimationTimer::m_Value
private

Definition at line 622 of file tools.c.

Referenced by GetValue(), Run(), and Tick().


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