using System.Collections; using System.Collections.Generic; using UnityEngine; using KairoEngine.Core; namespace KairoEngine.CharacterSystem { public class CharacterFollowTargetCommand : ICommand { CharacterController character; Transform target; float targetDistance; float speed; float animationSpeed; public CharacterFollowTargetCommand(CharacterController character, Transform target, float targetDistance, float speed, float animationSpeed = 1f) { this.character = character; this.target = target; this.targetDistance = targetDistance; this.speed = speed; this.animationSpeed = animationSpeed; } public void Execute() { CharacterFollowTargetAction action = new CharacterFollowTargetAction(character, target, targetDistance, speed, animationSpeed); ActionController actionController = character.GetComponent(); if(actionController.HasAction(action) == false) { actionController.AddAction(action); } } } }