AbstractSafetyAreaStep.cs 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using UnityEngine;
  5. public abstract class AbstractSafetyAreaStep<T> : ISafetyAreaStep
  6. {
  7. private Action onEnterStepCallback;
  8. private Action onExitStepCallback;
  9. protected T reference;
  10. public AbstractSafetyAreaStep(T reference)
  11. {
  12. this.reference = reference;
  13. }
  14. public virtual void RegistOnEnterStepCallback(Action callback)
  15. {
  16. onEnterStepCallback += callback;
  17. }
  18. public virtual void UnRegistOnEnterStepCallback(Action callback)
  19. {
  20. onEnterStepCallback -= callback;
  21. }
  22. public virtual void RegistOnExitStepCallback(Action callback)
  23. {
  24. onExitStepCallback += callback;
  25. }
  26. public virtual void UnRegistOnExitStepCallback(Action callback)
  27. {
  28. onExitStepCallback -= callback;
  29. }
  30. public virtual void OnEnterStep(object data)
  31. {
  32. onEnterStepCallback?.Invoke();
  33. }
  34. public virtual void OnExitStep()
  35. {
  36. onExitStepCallback?.Invoke();
  37. }
  38. public abstract void OnUserCancel();
  39. public abstract SafetyAreaStepEnum GetStepEnum();
  40. }