Example #1
0
    private void Update()
    {
        tickTimer += Time.deltaTime;
        if (!(tickTimer >= TICK_TIMER_MAX))
        {
            return;
        }

        tickTimer -= TICK_TIMER_MAX;
        _tick++;
        OnTick?.Invoke(this, new OnTickEventArgs {
            tick = _tick
        });

        if (_tick % 5 == 0)
        {
            OnTick_5?.Invoke(this, new OnTickEventArgs {
                tick = _tick
            });
        }
    }
 void Update()
 {
     timer += Time.deltaTime;
     if (timer >= TIMERMAX100)
     {
         timer -= TIMERMAX100;
         tick++;
         OnTick?.Invoke(this, System.EventArgs.Empty);
         if (tick % 2 == 0)
         {
             OnTick_2?.Invoke(this, System.EventArgs.Empty);
         }
         if (tick % 5 == 0)
         {
             OnTick_5?.Invoke(this, System.EventArgs.Empty);
         }
         if (tick % 10 == 0)
         {
             OnTick_10?.Invoke(this, System.EventArgs.Empty);
         }
     }
 }