ZombieMoveToPositionCommand.cs 1.0 KB

1234567891011121314151617181920212223242526272829303132333435
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using KairoEngine.Core;
  5. namespace KairoEngine.CharacterSystem
  6. {
  7. public class ZombieMoveToPositionCommand : ICommand
  8. {
  9. CharacterController character;
  10. Vector3 targetPosition;
  11. int varient;
  12. public ZombieMoveToPositionCommand(CharacterController character, Vector3 targetPosition, int varient)
  13. {
  14. this.character = character;
  15. this.targetPosition = targetPosition;
  16. this.varient = varient;
  17. }
  18. public void Execute()
  19. {
  20. ZombieMoveToPositionAction action = new ZombieMoveToPositionAction(character, targetPosition, varient);
  21. ActionController actionController = character.GetComponent<ActionController>();
  22. if(actionController.HasAction(action) == false)
  23. {
  24. actionController.AddAction(action);
  25. }
  26. else
  27. {
  28. actionController.ChangeAction(action);
  29. }
  30. }
  31. }
  32. }