You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Timer is a versatile, easy-to-use timer component designed for Unity projects. It supports basic timing operations like start, stop, and reset, along with advanced features such as pausing, resuming, fast forwarding, rewinding, and handling milestones that trigger custom actions.
3
+
## Overview
4
+
**Timers** is a versatile, easy-to-use timer component designed for Unity projects. Whether you’re building a countdown for a game level, managing cooldowns, or triggering events at specific intervals, this package provides a robust solution. It combines basic timing functionality with advanced features, all wrapped in an extensible and Unity-friendly design.
5
5
6
6
### Features
7
-
- Basic Timer Operations: Start, stop, and reset the timer.
8
-
- Pause and Resume: Pause the timer and resume from the last stopped point without resetting.
9
-
- Fast Forward and Rewind: Jump forward or backward in time.
10
-
-**Milestones:** Set up callbacks to execute when the timer reaches certain points.
11
-
-**Serialization:** Serialize and deserialize the timer's state, useful for game saves.
12
-
-**Extensible:** Easy to extend with additional features and integrate into larger systems.
13
-
14
-
## Installation ##
15
-
To install the Timers package in your Unity project, follow these steps:
16
-
17
-
1. Open Unity and navigate to the Package Manager.
18
-
- Click on the + button and select Add package from git URL...
19
-
- Enter the following URL: https://github.com/PaulNonatomic/Timer and press Add.
20
-
2. Add the Timer component onto any active GameObject in your scene, or create a new GameObject dedicated to the timer.
21
-
22
-
## Usage ##
23
-
24
-
## API Reference ##
25
-
* StartTimer(): Start or restart the timer.
26
-
* StopTimer(): Pause the timer.
27
-
* ResetTimer(): Reset the timer to its initial state.
28
-
* ResumeTimer(): Resume the timer from the last paused state.
29
-
* FastForward(float seconds): Advance the timer by a specified number of seconds.
30
-
* Rewind(float seconds): Reverse the timer by a specified number of seconds.
31
-
* AddMilestone(TimerMilestone milestone): Add a milestone that triggers a callback when reached.
32
-
* RemoveMilestone(TimerMilestone milestone): Remove a milestone from the timer.
33
-
* ClearMilestones(): Clears all milestones from the timer, ceasing any pending triggers.
34
-
* RemoveMilestonesByCondition(Predicate<TimerMilestone> condition): Removes a specific milestone from the timer.
35
-
36
-
## Contributing ##
37
-
Contributions are welcome! Please refer to CONTRIBUTING.md for guidelines on how to contribute.
38
-
39
-
## License ##
40
-
The Timers package is licensed under the MIT license. See LICENSE for more details.
7
+
-**Basic Operations**: Start, stop, reset, and query the timer’s state.
8
+
-**Pause & Resume**: Pause the timer and pick up where you left off.
9
+
-**Fast Forward & Rewind**: Skip ahead or backtrack through time.
10
+
-**Milestones**: Trigger custom actions at specific time or progress points.
11
+
-**Serialization**: Save and load timer states for persistent gameplay.
12
+
-**Unity Integration**: Works seamlessly as a MonoBehaviour or standalone class.
13
+
-**Extensible**: Virtual methods and interfaces make customization a breeze.
14
+
15
+
## Installation
16
+
Add the Timers package to your Unity project via the Unity Package Manager:
17
+
18
+
1. Open the Package Manager (`Window > Package Manager`).
19
+
2. Click the **+** button and select **"Add package from git URL"**.
0 commit comments