using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using KairoEngine.Core;
namespace KairoEngine.CharacterSystem
{
public class ZombieFollowTargetCommand : ICommand
{
CharacterController character;
Transform target;
float targetDistance;
int variant;
///
/// Command that creates an action that will make a character follow a target playing a zombie animation.
///
/// The CharacterController performing the action
/// The target Transform to be followed
/// Stop following when this distance is reached
/// Type of zombie animation to play. 1 to 7 are walk animations and 8 to 9 are run animations
public ZombieFollowTargetCommand(CharacterController character, Transform target, float targetDistance, int variant)
{
this.character = character;
this.target = target;
this.targetDistance = targetDistance;
this.variant = variant;
}
public void Execute()
{
ZombieFollowTargetAction action = new ZombieFollowTargetAction(character, target, targetDistance, variant);
ActionController actionController = character.GetComponent();
if(actionController.HasAction(action) == false)
{
actionController.AddAction(action);
}
}
}
}