AbstractSafetyAreaStep.cs 901 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using UnityEngine;
  5. public class AbstractSafetyAreaStep : ISafetyAreaStep
  6. {
  7. private Action onEnterStepCallback;
  8. private Action onExitStepCallback;
  9. public virtual void RegistOnEnterStepCallback(Action callback)
  10. {
  11. onEnterStepCallback += callback;
  12. }
  13. public virtual void UnRegistOnEnterStepCallback(Action callback)
  14. {
  15. onEnterStepCallback -= callback;
  16. }
  17. public virtual void RegistOnExitStepCallback(Action callback)
  18. {
  19. onExitStepCallback += callback;
  20. }
  21. public virtual void UnRegistOnExitStepCallback(Action callback)
  22. {
  23. onExitStepCallback -= callback;
  24. }
  25. public virtual void OnEnterStep()
  26. {
  27. onEnterStepCallback?.Invoke();
  28. }
  29. public virtual void OnExitStep()
  30. {
  31. onExitStepCallback?.Invoke();
  32. }
  33. }