Quick Start Guide
The Eidolon.Timer
class provides a flexible and customizable timer functionality for Unity game development. It allows you to create timers with specific durations and attach callback functions to various events such as timer start, stop, pause, resume, and completion.
Example Usage
1. Creating a Timer and Starting it:
2. Pausing and Resuming a Timer:
3. Stopping and Resetting a Timer:
4. Checking Timer Status:
5. Handling Timer Events:
Remarks
- Ensure that you call the
Update()
method of theGameTimer
instance in theUpdate()
method of a MonoBehaviour to update the timer’s internal state. - You can attach callback functions to respond to timer events such as start, stop, pause, resume, and completion by using delegate assignment (
+=
) syntax. - The timer automatically stops when its duration is reached, and the associated completion callback is invoked.
- Use the
GetElapsedTime()
andGetDuration()
methods to retrieve the current elapsed time and total duration of the timer, respectively.