Search Results for

    Show / Hide Table of Contents

    TimerEvent

    カウントダウンのタイマーで時間によるイベントを設定できます。

    namespace GarageKit
    public class TimerEvent : MonoBehaviour
    

    Inheritance

    TimerEvent -> MonoBehaviour

    Methods

    タイマー開始済み確認

    public bool IsStarted { get; }
    

    タイマー実行中確認

    public bool IsRunning { get; }
    

    タイマー残り時間(秒)

    public int CurrentTime { get; }
    

    タイマー経過時間(秒)

    public float ElapsedTime { get; }
    

    タイマー毎秒経過イベント

    public event OnTimerDelegate OnTimer
    

    タイマー完了イベント

    public event OnCompleteTimerDelegate OnCompleteTimer
    

    タイマーの開始

    public void StartTimer(int countTime, float delayTime = 0.0f, bool autoDestroy = false)
    

    タイマーの停止

    public void StopTimer()
    

    タイマーの一時停止

    public void ResumeTimer()
    

    タイマーのリセット

    public void ResetTimer(bool andStart)
    

    Example

    • /Scenes/Examples/EventExample.unity
    GameObject obj = new GameObject("TimerEventObject"); 
    obj.AddComponent<TimerEvent>();
    obj.GetComponent<TimerEvent>().OnTimer += (sender, sec) => {};
    obj.GetComponent<TimerEvent>().OnCompleteTimerEvent += (sender) => {};
    obj.GetComponent<TimerEvent>().StartTimer(10); // count down 10 sec
    
    • Edit this page
    In this article
    Back to top Generated by DocFX