1234567891011121314151617181920212223242526272829303132333435 |
- 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<ActionController>();
- if(actionController.HasAction(action) == false)
- {
- actionController.AddAction(action);
- }
- }
- }
- }
|