StreamRoot.cs 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. using UnityEngine;
  2. using System;
  3. using System.Collections;
  4. using System.Collections.Generic;
  5. using UnityEngine.Events;
  6. public abstract class StreamRoot : TweenRoot
  7. {
  8. #region
  9. public bool AtOrigin;
  10. public bool AtDestination;
  11. public int Phase;
  12. public int TotPhase;
  13. public bool ActionLock;
  14. public bool Consecutive;
  15. public float TempDelay;
  16. public float TempDuration;
  17. public List<float> DelayList = new List<float>();
  18. public List<float> DurationList = new List<float>();
  19. public List<UnityAction> StartActionList = new List<UnityAction>();
  20. public List<UnityAction> FinishActionList = new List<UnityAction>();
  21. #endregion
  22. public StreamRoot( bool cg, Curve curve, Component comp) : base(cg, curve, comp)
  23. {
  24. }
  25. public override bool StartForward()
  26. {
  27. InPause = false;
  28. if (InForward || AtDestination)
  29. {
  30. return true;
  31. }
  32. Timer = 0;
  33. InForward = true;
  34. AtOrigin = false;
  35. Component.SetActive(true);
  36. if (InOrigin)
  37. {
  38. OnForwardStart.SafeInvoke();
  39. }
  40. if (CG)
  41. {
  42. CanvasGroup.interactable = false;
  43. }
  44. if (InBackward)
  45. {
  46. ManaAnim.MoveBacList.Remove(this);
  47. }
  48. ManaAnim.MoveForList.Add(this);
  49. return false;
  50. }
  51. public override bool StartBackward()
  52. {
  53. InPause = false;
  54. if (InBackward || AtOrigin)
  55. {
  56. return true;
  57. }
  58. Timer = 0;
  59. InBackward = true;
  60. AtDestination = false;
  61. Component.SetActive(true);
  62. OnBackwardStart.SafeInvoke();
  63. if (CG)
  64. {
  65. CanvasGroup.interactable = false;
  66. }
  67. if (InForward)
  68. {
  69. ManaAnim.MoveForList.Remove(this);
  70. }
  71. ManaAnim.MoveBacList.Add(this);
  72. return false;
  73. }
  74. public override void ForwardFinish()
  75. {
  76. base.ForwardFinish();
  77. AtOrigin = false;
  78. AtDestination = true;
  79. }
  80. public override void BackwardFinish()
  81. {
  82. base.BackwardFinish();
  83. AtOrigin = true;
  84. AtDestination = false;
  85. }
  86. }