using UnityEngine; namespace Invector.vCharacterController.AI.FSMBehaviour { public class vSetAnimatorParameter : vStateAction { public enum ParameterType { Float, Int, Bool, Trigger } public override string categoryName { get { return "Custom Example/"; } } public override string defaultName { get { return "Set Animator Parameter"; } } public ParameterType parameterType = ParameterType.Bool; public string parameterName = ""; [Space] public float floatValue; public int intValue; public bool boolValue; public override void DoAction(vIFSMBehaviourController fsmBehaviour, vFSMComponentExecutionType executionType = vFSMComponentExecutionType.OnStateUpdate) { if (!string.IsNullOrEmpty(parameterName)) { switch (parameterType) { case ParameterType.Float: fsmBehaviour.aiController.animator.SetFloat(parameterName, floatValue); break; case ParameterType.Int: fsmBehaviour.aiController.animator.SetInteger(parameterName, intValue); break; case ParameterType.Bool: fsmBehaviour.aiController.animator.SetBool(parameterName, boolValue); break; case ParameterType.Trigger: fsmBehaviour.aiController.animator.SetTrigger(parameterName); break; } } } } }