Exemple #1
0
 public GammaTimer(TimeSpan time, Action OnTimerElapsed, bool autodestroy = true)
 {
     this.OnTimerElapsed = OnTimerElapsed;
     this.remainingTime  = time;
     this.autodestroy    = autodestroy;
     this.timeHelper     = GammaTimerHelper.CreateHelper();
 }
Exemple #2
0
 public GammaIntervallTimer(TimeSpan intervallTime, int intevallCount, Action <int> OnIntervallElpased, bool autodestroy = true)
 {
     this.startIntervallTime     = intervallTime;
     this.remainingIntevallCount = intevallCount;
     this.OnIntervallElpased     = OnIntervallElpased;
     this.autodestroy            = autodestroy;
     this.timeHelper             = GammaTimerHelper.CreateHelper();
 }
    public static GammaTimerHelper CreateHelper()
    {
        if (helperGO == null)
        {
            helperGO = new GameObject("GammaTimeHelper");
        }

        GammaTimerHelper helper = helperGO.AddComponent <GammaTimerHelper>();

        DontDestroyOnLoad(helper);
        return(helper);
    }