1234567891011121314151617181920212223242526272829303132333435363738 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using KairoEngine.Core;
- namespace KairoEngine.CharacterSystem
- {
- public class ZombieAttackCommand : ICommand
- {
- CharacterController character;
- Transform target;
- Vector3 targetPosition;
- string 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="targetPosition">The target position that the attack will hit.</param>
- /// <param name="varient">Use "AttackL", "AttackR" or "Attack".</param>
- public ZombieAttackCommand(CharacterController character, Vector3 targetPosition, string variant)
- {
- this.character = character;
- this.targetPosition = targetPosition;
- this.variant = variant;
- }
- public void Execute()
- {
- ZombieAttackAction action = new ZombieAttackAction(character, targetPosition, variant);
- ActionController actionController = character.GetComponent<ActionController>();
- if(actionController.HasAction(action) == false)
- {
- actionController.AddAction(action);
- }
- }
- }
- }
|