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

39 lines
1.0 KiB
C#

using NodeCanvas.Framework;
using NodeCanvas.Framework.Internal;
using ParadoxNotion.Design;
namespace NodeCanvas.Tasks.Conditions
{
[Name("On Variable Changed")]
[Category("✫ Blackboard")]
public class BBVariableChanged : ConditionTask
{
[BlackboardOnly] public BBObjectParameter targetVariable;
protected override string info {
get { return targetVariable + " Changed."; }
}
protected override string OnInit() {
if ( targetVariable.isNone ) {
return "Blackboard Variable not set.";
}
return null;
}
protected override void OnEnable() {
targetVariable.varRef.onValueChanged += OnValueChanged;
}
protected override void OnDisable() {
targetVariable.varRef.onValueChanged -= OnValueChanged;
}
protected override bool OnCheck() { return false; }
private void OnValueChanged(object varValue) {
YieldReturn(true);
}
}
}