12345678910111213141516171819202122232425262728293031323334353637383940 |
- 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;
- /// <summary>
- /// Command that creates an action that will make a character follow a target playing a zombie animation.
- /// </summary>
- /// <param name="character">The CharacterController performing the action</param>
- /// <param name="target">The target Transform to be followed</param>
- /// <param name="targetDistance">Stop following when this distance is reached</param>
- /// <param name="varient">Type of zombie animation to play. 1 to 7 are walk animations and 8 to 9 are run animations</param>
- 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<ActionController>();
- if(actionController.HasAction(action) == false)
- {
- actionController.AddAction(action);
- }
- }
- }
- }
|