Class TimerProgress
An abstract base timer class that is intended to be used on any component/class that needs something to
happen after X
couple seconds. Supports duration, and the ability to loop.
Inheritance
Namespace: AdrianMiasik.Components.Base
Assembly: Assembly-CSharp.dll
Syntax
public abstract class TimerProgress : MonoBehaviour
Fields
| Improve this Doc View Sourcem_duration
How long should this timer run for? (In seconds)
Declaration
[SerializeField]
protected float m_duration
Field Value
Type | Description |
---|---|
System.Single |
m_onComplete
Declaration
public UnityEvent m_onComplete
Field Value
Type | Description |
---|---|
UnityEngine.Events.UnityEvent |
Methods
| Improve this Doc View SourceInitialize(Single, Boolean)
Sets up and starts the timer using the provided preferences.
Declaration
public void Initialize(float timerDuration, bool loop = false)
Parameters
Type | Name | Description |
---|---|---|
System.Single | timerDuration | How long should this timer run for? |
System.Boolean | loop | Should the timer repeat on completion? |
IsRunning()
Returns the active running state of the timer.
Declaration
public bool IsRunning()
Returns
Type | Description |
---|---|
System.Boolean | Is timer updating/ticking/running right now? |
OnComplete()
Invoked when the timer has completed.
Declaration
protected abstract void OnComplete()
OnStart()
Invoked on timer start / component initialization.
Declaration
protected abstract void OnStart()
OnUpdate(Single)
Update loop for timer.
Declaration
protected abstract void OnUpdate(float progress)
Parameters
Type | Name | Description |
---|---|---|
System.Single | progress | A progress value between 0 to 1 |
Restart()
Restarts the timer and immediately starts the timer.
Declaration
protected void Restart()
Update()
Update/tick method for timer progression.
Declaration
protected virtual void Update()