using System.Collections; using System.Collections.Generic; using UnityEngine; using KairoEngine.Core; namespace KairoEngine.CharacterSystem { public class MoveCommand : ICommand { CharacterController character; Vector2 direction; Vector2 lookDirection; float speed; public MoveCommand(CharacterController character, Vector2 direction, Vector2 lookDirection, float speed) { this.character = character; this.direction = direction; this.lookDirection = lookDirection; this.speed = speed; } public void Execute() { CharacterMoveAction action = new CharacterMoveAction(character, direction, lookDirection, speed); ActionController actionController = character.GetComponent(); if(actionController.HasAction(action) == false) { actionController.AddAction(action); } else { actionController.ChangeAction(action); } } } }