TurnCommand.cs 801 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 TurnCommand : ICommand
  8. {
  9. CharacterController character;
  10. Vector3 point;
  11. public TurnCommand(CharacterController character, Vector3 point)
  12. {
  13. this.character = character;
  14. this.point = point;
  15. }
  16. public void Execute()
  17. {
  18. CharacterTurnToPointAction action = new CharacterTurnToPointAction(character, point);
  19. ActionController actionController = character.GetComponent<ActionController>();
  20. if(!actionController.HasAction(action))
  21. {
  22. actionController.AddAction(action);
  23. }
  24. }
  25. }
  26. }