IndieGame/client/Assets/ParadoxNotion/NodeCanvas/Tasks/Actions/Animator/MecanimSetTrigger.cs
DOBEST\zhaoyingjie f242607587 初始化工程
2024-10-11 10:12:15 +08:00

31 lines
995 B
C#

using NodeCanvas.Framework;
using ParadoxNotion.Design;
using UnityEngine;
namespace NodeCanvas.Tasks.Actions
{
[Name("Set Parameter Trigger")]
[Category("Animator")]
[Description("You can either use a parameter name OR hashID. Leave the parameter name empty or none to use hashID instead.")]
public class MecanimSetTrigger : ActionTask<Animator>
{
public BBParameter<string> parameter;
public BBParameter<int> parameterHashID;
protected override string info {
get { return string.Format("Mec.SetTrigger {0}", string.IsNullOrEmpty(parameter.value) && !parameter.useBlackboard ? parameterHashID.ToString() : parameter.ToString()); }
}
protected override void OnExecute() {
if ( !string.IsNullOrEmpty(parameter.value) ) {
agent.SetTrigger(parameter.value);
} else {
agent.SetTrigger(parameterHashID.value);
}
EndAction();
}
}
}