Animator Has State#
Animation / Animator / Animator Has State
Description#
Compares the Has State method of Animator component to another value
Parameters#
| Name | Description |
|---|---|
| Animator | |
| Layer Index | |
| State ID |
Code#
// <auto-generated>
// This script was automatically generated using the Visual Script Transpiler.
// Do not modify. Changes to this file will be lost when updating the package.
// </auto-generated>
using System;
using UnityEngine;
using VisualScript.Icons;
namespace VisualScript.Runtime
{
[Title("Animator Has State")]
[Category("Animation/Animator/Has State")]
[Description("Compares the Has State method of Animator component to another value")]
[Image(typeof(IconAnimator), ColorTheme.Type.Teal)]
[Keywords("Animation, Clip, Play, Animate")]
[Parameter("Animator")]
[Parameter("Layer Index")]
[Parameter("State ID")]
[Serializable]
public class GenConditionBool_Animator_CheckHasState_2 : Condition
{
[SerializeField] private GetGameObject m_Animator = new GetGameObject(
new GenTypeGameObject_Animator()
);
[SerializeField] private GetInteger m_LayerIndex = new GetInteger();
[SerializeField] private GetInteger m_StateID = new GetInteger();
protected override string GetTitle(GameObject source)
{
string method = TextUtils.ThemeAsKeyword("Has State");
string parameters = $"({this.m_LayerIndex}, {this.m_StateID})";
return $"{this.m_Animator} {method}";
}
protected override bool Run(Args args)
{
Animator component = this.m_Animator.Get<Animator>(args);
if (component == null) return false;
bool value = component.HasState(
(int) this.m_LayerIndex.Get(args),
(int) this.m_StateID.Get(args)
);
return value;
}
}
}