TimeTickSystem.cs 647 B

12345678910111213141516171819202122232425262728
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. namespace KairoEngine.Core
  5. {
  6. public class TimeTickSystem : MonoBehaviour
  7. {
  8. public const float TICK_TIMER_MAX = .2f;
  9. private int tick;
  10. private float tickTimer;
  11. private void Awake () => tick = 0;
  12. private void Update ()
  13. {
  14. tickTimer += Time.deltaTime;
  15. if(tickTimer >= TICK_TIMER_MAX)
  16. {
  17. tickTimer -= TICK_TIMER_MAX;
  18. tick++;
  19. // Debug.Log(tick);
  20. GenericEvents.Trigger("Tick", tick);
  21. }
  22. }
  23. }
  24. }