Attackable.cs 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. using System;
  2. using CIS;
  3. using DG.Tweening;
  4. using UnityEngine;
  5. [SerializeField]
  6. public class Attackable : MonoBehaviour
  7. {
  8. protected virtual void Start()
  9. {
  10. this._next = new Attackable[]
  11. {
  12. this.next
  13. };
  14. }
  15. public virtual bool IsFixYSpeed(Attackable next)
  16. {
  17. return false;
  18. }
  19. public virtual float GetFutureTime(Attackable next)
  20. {
  21. return this.futureTime;
  22. }
  23. public virtual void PlayAnimationAfterTime(string name, float time)
  24. {
  25. }
  26. public virtual void SetJumpTween(Tween tween)
  27. {
  28. this.attackerJumpTween = tween;
  29. }
  30. public virtual bool Action(Attackable next)
  31. {
  32. return true;
  33. }
  34. public virtual bool Available()
  35. {
  36. return true;
  37. }
  38. public virtual void React(Vector2 dir, float delay = 0f)
  39. {
  40. }
  41. public virtual Attackable[] Next()
  42. {
  43. return this._next;
  44. }
  45. public virtual bool AffectGravity()
  46. {
  47. return false;
  48. }
  49. public virtual void Update()
  50. {
  51. if (SingletonMonoBehaviourClass<GameLogicMgr>.instance.IsPause())
  52. {
  53. return;
  54. }
  55. if (this.next != null && this.nextNotificationSprite != null)
  56. {
  57. Vector2 v = this.next.transform.position - base.transform.position;
  58. this.nextNotificationSprite.transform.localPosition = Vector2.zero;
  59. this.nextNotificationSprite.transform.rotation = Quaternion.FromToRotation(Vector2.right, v);
  60. this.nextNotificationSprite.transform.Translate(this.nextNotificationRadius * 2f, 0f, 0f);
  61. }
  62. }
  63. public virtual void OnPickingTime(float time)
  64. {
  65. }
  66. public Attackable next;
  67. public int index;
  68. public float futureTime = 0.13333334f;
  69. public float gravityFactor = 1f;
  70. public float horizenalAccelFactor = 1f;
  71. public float overrideVelY;
  72. public bool needNextNotification;
  73. public SpriteRenderer nextNotificationSprite;
  74. public float nextNotificationRadius;
  75. protected Tween attackerJumpTween;
  76. protected Attackable[] _next;
  77. }