You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

41 line
1018B

  1. using System;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. namespace coa4u
  5. {
  6. /// <summary>
  7. /// Delays the action for the given amount of seconds.
  8. /// </summary>
  9. class ActionDelay : ActionInterval
  10. {
  11. protected float durationMin;
  12. protected float durationMax;
  13. public ActionDelay(float tgtDuration)
  14. : base(tgtDuration)
  15. {
  16. durationMin = tgtDuration;
  17. durationMax = tgtDuration;
  18. }
  19. public ActionDelay(float tgtDuration, float tgtDurationMax)
  20. : base(tgtDuration)
  21. {
  22. durationMin = tgtDuration;
  23. durationMax = tgtDurationMax;
  24. }
  25. /// <summary>
  26. /// This method is called at the action start.
  27. /// </summary>
  28. public override void start()
  29. {
  30. base.start();
  31. if (durationMax != null)
  32. {
  33. duration = UnityEngine.Random.Range(durationMin, durationMax);
  34. }
  35. }
  36. }
  37. }