All Projects → SushiWaUmai → Chronity

SushiWaUmai / Chronity

Licence: MIT license
⌛ Library for running functions after a delay by creating timers in Unity3D.

Programming Languages

C#
18002 projects
CSS
56736 projects

Projects that are alternatives of or similar to Chronity

Http Timer
🕐 Performance timings for HTTP requests
Stars: ✭ 156 (+290%)
Mutual labels:  timer
React Native Countdown Component
React Native CountDown
Stars: ✭ 193 (+382.5%)
Mutual labels:  timer
template-unity-package
A Github template for creating a new Unity Package. Hit the green "User this template" next to "Clone or download" to get started!
Stars: ✭ 50 (+25%)
Mutual labels:  openupm
Clock
A low consumption, low latency support for frequent updates of large capcity timing manage
Stars: ✭ 161 (+302.5%)
Mutual labels:  timer
Gcdtimer
Well-tested GCD Timer in Swift
Stars: ✭ 179 (+347.5%)
Mutual labels:  timer
Pomodoro
Pomodoro time managment tool build with electron 🍅
Stars: ✭ 204 (+410%)
Mutual labels:  timer
Launchbar
LaunchBar Actions
Stars: ✭ 155 (+287.5%)
Mutual labels:  timer
event pool
a header-only event-driven library based on c++11.
Stars: ✭ 27 (-32.5%)
Mutual labels:  timer
Duetimer
⏳ Timer Library fully implemented for Arduino DUE
Stars: ✭ 184 (+360%)
Mutual labels:  timer
Tomato Clock
Tomato Clock is a simple browser extension for managing your productivity.
Stars: ✭ 241 (+502.5%)
Mutual labels:  timer
Schedex
Simple scheduling for Elixir
Stars: ✭ 173 (+332.5%)
Mutual labels:  timer
Hgcircularslider
A custom reusable circular / progress slider control for iOS application.
Stars: ✭ 2,240 (+5500%)
Mutual labels:  timer
Pdd
📅 Tiny date, time diff calculator with piggybacked timers
Stars: ✭ 218 (+445%)
Mutual labels:  timer
Sc
Common libraries and data structures for C.
Stars: ✭ 161 (+302.5%)
Mutual labels:  timer
STM32 TimerInterrupt
This library enables you to use Interrupt from Hardware Timers on an STM32F/L/H/G/WB/MP1-based board. These STM32F/L/H/G/WB/MP1 Hardware Timers, using Interrupt, still work even if other functions are blocking. Moreover, they are much more precise (certainly depending on clock frequency accuracy) than other software timers using millis() or micr…
Stars: ✭ 27 (-32.5%)
Mutual labels:  timer
Ects
Elastic Crontab System 简单易用的分布式定时任务管理系统
Stars: ✭ 156 (+290%)
Mutual labels:  timer
Timelite
Why is it 5 AM? Isn't there something simple I can use to track what I'm doing with all this time?
Stars: ✭ 201 (+402.5%)
Mutual labels:  timer
UnityTimer
Powerful and convenient library for running actions after a delay in Unity3D. Fork from akbiggs/UnityTimer. Add some useful functions.
Stars: ✭ 26 (-35%)
Mutual labels:  timer
iris
Lightweight Component Model and Messaging Framework based on ØMQ
Stars: ✭ 50 (+25%)
Mutual labels:  timer
React Countdown Circle Timer
Lightweight React/React Native countdown timer component with color and progress animation based on SVG
Stars: ✭ 220 (+450%)
Mutual labels:  timer

# Chronity

Release OpenUPM LISENCE Compatibility GitHub Repo stars

A library for running functions after a delay in Unity.

This package is a fork of the UnityTimer made by akbiggs.

To get started, read the docs or follow this README file.

Table of Contents

Getting Started 🚀

Installation

Please follow the instructions in the manual about Installing a package from a Git URL.

Use the following URL to install the latest version of the package: https://github.com/SushiWaUmai/Chronity.git?path=/com.sushiwaumai.chronity

Quick Start 🎓

This is how to call a function after a delay in Chronity.

// Log "Hello World" after five seconds.

Timer.Register(5f, () => Debug.Log("Hello World"));

Features

Make a timer repeat by setting isLooped to true.

// Log "Hello World" every 10 seconds.

Timer.Register(10f, () => Debug.Log("Hello World"), isLooped: true);

Cancel a timer after calling it.

Timer timer;

private void Start()
{
    timer = Timer.Register(2f, () => Debug.Log("You won't see this text if you press X."));
}

private void Update()
{
    if (Input.GetKeyDown(KeyCode.X)) 
    {
        timer.Cancel();
    }
}

Attach the timer to a MonoBehaviour so that the timer is destroyed when the MonoBehaviour is.

Very often, a timer called from a MonoBehaviour will manipulate that behaviour's state. Thus, it is common practice to cancel the timer in the OnDestroy method of the MonoBehaviour. We've added a convenient extension method that attaches a Timer to a MonoBehaviour such that it will automatically cancel the timer when the MonoBehaviour is detected as null.

public class CoolMonoBehaviour : MonoBehaviour
{
    private void Start() 
    {
        // Use the AttachTimer extension method to create a timer that is destroyed when this
        // object is destroyed.
        this.AttachTimer(5f, () => {
      
            // If this code runs after the object is destroyed, a null reference will be thrown,
            // which could corrupt game state.
            this.gameObject.transform.position = Vector3.zero;
        });
    }
   
    private void Update() 
    {
        // This code could destroy the object at any time!
        if (Input.GetKeyDown(KeyCode.X)) 
        {
            GameObject.Destroy(this.gameObject);
        }
    }
}

Update a value gradually over time using the onUpdate callback.

// Change a color from white to red over the course of five seconds.
Color color = Color.white;
float transitionDuration = 5f;

Timer.Register(transitionDuration,
   onUpdate: secondsElapsed => color.r = 255 * (secondsElapsed / transitionDuration),
   onComplete: () => Debug.Log("Color is now red"));

Make a timer presist through scene changes using the cancelOnSceneChange parameter.

// Make a timer that will persist through scene changes.
Timer.Register(5f, () => Debug.Log("Hello World"), cancelOnSceneChange: false);

// Change scene from another script 

// Logs "Hello World" after 5 seconds.

Make a timer run in the editor by using the EditorTimer class.

// Logs "Hello World" after 5 seconds in the editor

EditorTimer.Register(5, () => Debug.Log("Hello World"));

A number of other useful features are included!

  • time.Pause()
  • timer.Resume()
  • timer.TimePassed
  • timer.TimeRemaining
  • timer.RatioComplete
  • timer.IsDone

License 📜

Code released under the MIT License.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].