SFX_ControlledObject.cs 659 B

1234567891011121314151617181920212223242526272829303132333435
  1. using UnityEngine;
  2. // ReSharper disable once CheckNamespace
  3. namespace QFX.SFX
  4. {
  5. public class SFX_ControlledObject : MonoBehaviour
  6. {
  7. public bool RunAtStart = true;
  8. public float Delay;
  9. public bool IsRunning { get; private set; }
  10. private void OnEnable()
  11. {
  12. Setup();
  13. if (RunAtStart)
  14. SFX_InvokeUtil.RunLater(this, Run, Delay);
  15. }
  16. public virtual void Setup()
  17. {
  18. }
  19. public virtual void Run()
  20. {
  21. IsRunning = true;
  22. }
  23. public virtual void Stop()
  24. {
  25. IsRunning = false;
  26. }
  27. }
  28. }