M&B: Bannerlord 1.0.0
The horns sound, the ravens gather.
Loading...
Searching...
No Matches
TaleWorlds.Core.Timer Class Reference

A timer class that alarms when given amount of time has passed.

Inherited by TaleWorlds.MountAndBlade.RandomTimer.

Public Member Functions

 Timer (float gameTime, float duration, bool autoReset=true)
 Initializes a new instance of the Timer class. More...
 
virtual bool Check (float gameTime)
 Checks if the required amount of time has passed or not. More...
 
float ElapsedTime ()
 Gets the amount of time that has passed since the timer has started for the next alarm. More...
 
void Reset (float gameTime)
 
void Reset (float gameTime, float newDuration)
 
void AdjustStartTime (float deltaTime)
 

Properties

float Duration [get, protected set]
 Duration after which the timer alarms. More...
 
float PreviousDeltaTime [get]
 The time elapsed before the alarm rang. More...
 

Constructor & Destructor Documentation

◆ Timer()

TaleWorlds.Core.Timer.Timer ( float  gameTime,
float  duration,
bool  autoReset = true 
)
Parameters
gameTimeCurrent time of the time type that will be used for checking.
durationDuration after which the timer alarms.
autoResetIf the timer should reset after alarming or not. IMPORTANT: If true, it is impossible to check the timer multiple times in a frame (only first check will return true, and then it will reset and return false)

Member Function Documentation

◆ Check()

virtual bool TaleWorlds.Core.Timer.Check ( float  gameTime)
virtual
Parameters
gameTimeCurrent time of the time type that is used for checking.
Returns
Returns true if the required amount of time has passed.

Reimplemented in TaleWorlds.MountAndBlade.RandomTimer.

◆ ElapsedTime()

float TaleWorlds.Core.Timer.ElapsedTime ( )
Returns
The amount of time that has passed since the timer has started for the next alarm.

◆ Reset() [1/2]

void TaleWorlds.Core.Timer.Reset ( float  gameTime)

◆ Reset() [2/2]

void TaleWorlds.Core.Timer.Reset ( float  gameTime,
float  newDuration 
)

◆ AdjustStartTime()

void TaleWorlds.Core.Timer.AdjustStartTime ( float  deltaTime)

Property Documentation

◆ Duration

float TaleWorlds.Core.Timer.Duration
getprotected set

◆ PreviousDeltaTime

float TaleWorlds.Core.Timer.PreviousDeltaTime
get