CharacterAimTaskAction.cs 1019 B

123456789101112131415161718192021222324252627282930313233
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using NodeCanvas.Framework;
  5. using ParadoxNotion.Design;
  6. using KairoEngine.Core;
  7. namespace KairoEngine.CharacterSystem
  8. {
  9. [Category("KairoEngine")]
  10. public class CharacterAimTaskAction : ActionTask
  11. {
  12. [BlackboardOnly, RequiredField] public BBParameter<CharacterController> character;
  13. [BlackboardOnly, RequiredField] public BBParameter<Transform> target;
  14. protected override string info
  15. {
  16. get { return "Aim at Target"; }
  17. }
  18. protected override void OnExecute()
  19. {
  20. if(target.value == false) EndAction(false);
  21. ICommand mousePosCommand = new TurnCommand(character.value, target.value.position);
  22. CommandInvoker.AddCommand(mousePosCommand);
  23. ICommand aimCommand = new CharacterAimCommand(character.value, target.value);
  24. CommandInvoker.AddCommand(aimCommand);
  25. EndAction(true);
  26. }
  27. }
  28. }