959e80cf72
assets upload description.
48 lines
1.3 KiB
C#
48 lines
1.3 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using XNode;
|
|
using RPGCreationKit.BehaviourTree.Data;
|
|
|
|
namespace RPGCreationKit.BehaviourTree
|
|
{
|
|
[CreateNodeMenu("RPGCK_BehaviourTree/Comparison/Bool Check", order = 1)]
|
|
[System.Serializable]
|
|
public class CBoolCheckNode : BTNode
|
|
{
|
|
public bool not = false;
|
|
public BT_Bool boolToCheck;
|
|
|
|
public override void OnStart()
|
|
{
|
|
if (boolToCheck)
|
|
boolToCheck = (BT_Bool)BTReference.SolveReference(this.graph as RPGCK_BT, boolToCheck.name);
|
|
|
|
STARTED = true;
|
|
}
|
|
|
|
public override NodeState Execute()
|
|
{
|
|
if (m_NodeState == NodeState.Success || m_NodeState == NodeState.Failure)
|
|
if (hasEvaluated == true)
|
|
return m_NodeState;
|
|
|
|
if (!STARTED)
|
|
OnStart();
|
|
|
|
if(not)
|
|
m_NodeState = (boolToCheck.value) ? NodeState.Failure : NodeState.Success;
|
|
else
|
|
m_NodeState = (boolToCheck.value) ? NodeState.Success : NodeState.Failure;
|
|
|
|
hasEvaluated = true;
|
|
return m_NodeState;
|
|
}
|
|
|
|
public override void ReEvaluate()
|
|
{
|
|
if (m_NodeState != NodeState.Running)
|
|
base.ReEvaluate();
|
|
}
|
|
}
|
|
} |