CharacterAimCommand.cs 820 B

1234567891011121314151617181920212223242526272829
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using KairoEngine.Core;
  5. namespace KairoEngine.CharacterSystem
  6. {
  7. public class CharacterAimCommand : ICommand
  8. {
  9. CharacterController character;
  10. Transform target;
  11. public CharacterAimCommand(CharacterController character, Transform target)
  12. {
  13. this.character = character;
  14. this.target = target;
  15. }
  16. public void Execute()
  17. {
  18. CharacterAimAction action = new CharacterAimAction(character, target);
  19. ActionController actionController = character.GetComponent<ActionController>();
  20. if(actionController.HasAction(action) == false)
  21. {
  22. actionController.AddAction(action);
  23. }
  24. }
  25. }
  26. }