Timer - Team-Swamp/IceBites GitHub Wiki

Overview

A easy to use timer class. With multiple events that can be used. There is an editor script that inhance the usage of the timer class.

Writen by - Bas

Usage

Methods Return Description
+ ResetTimer void Reset the timer to startingTime and calls the onReset event
+ SetCanCount(bool) void Set the canCount property, when setting it to true it will start counting, otherwise is stops
+ SetTimerLenght(float) void Set the timer lenght, when resetting it will use this number
+ GetCurrentTimerLenght float Get the timer it's current lenght
+ GetCurrentTimerPercentage float Calculates the percentage of the current timer relative to the progress. Return a number between 0-1
+ ToggleTimerLengthPreference void Toggles the current timer to the big lenght if previously was small, otherwise in reverse
- Counting void The function that counts the timer. Calls events when it's needs to
Events Description
onTimerDone An event for when the timer is done with counting
onTimerPassedThreshold An event for when the timer is has passed the threshold when counting up
onStart An event for when starting counting
onReset An event for when reseting the timer
Timer class Unity inspector

image image

Source

You want to see how it works Timer.cs, there is also a custom editor script for it. Also a sctruct for timer data.

⚠️ **GitHub.com Fallback** ⚠️