RiderAIAction.cs 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. using System;
  2. using BehaviorDesigner.Runtime.Tasks;
  3. using UnityEngine;
  4. public class RiderAIAction
  5. {
  6. [TaskCategory("Enemy/Rider")]
  7. [TaskDescription("Rider攻击")]
  8. public class RiderAttack : BehaviorDesigner.Runtime.Tasks.Action
  9. {
  10. private Transform player
  11. {
  12. get
  13. {
  14. return R.Player.Transform;
  15. }
  16. }
  17. public override void OnAwake()
  18. {
  19. this.action = base.GetComponent<RiderAction>();
  20. }
  21. public override void OnStart()
  22. {
  23. int dir = InputSetting.JudgeDir(this.transform.position, this.player.position);
  24. RiderAIAction.RiderAttack.AtkType atkType = this.atkType;
  25. if (atkType != RiderAIAction.RiderAttack.AtkType.Atk1)
  26. {
  27. if (atkType != RiderAIAction.RiderAttack.AtkType.Atk2)
  28. {
  29. if (atkType == RiderAIAction.RiderAttack.AtkType.Atk3)
  30. {
  31. this.action.Attack3(dir);
  32. }
  33. }
  34. else
  35. {
  36. this.action.Attack2(dir);
  37. }
  38. }
  39. else
  40. {
  41. this.action.Attack1(dir);
  42. }
  43. }
  44. public override TaskStatus OnUpdate()
  45. {
  46. return TaskStatus.Success;
  47. }
  48. public RiderAIAction.RiderAttack.AtkType atkType;
  49. private RiderAction action;
  50. public enum AtkType
  51. {
  52. Atk1,
  53. Atk2,
  54. Atk3
  55. }
  56. }
  57. }