public override BTResult Execute() { NodePort inPort = GetPort("inResult"); if (inPort != null && inPort.GetConnections().Count != 0) { NodePort connection = inPort.GetConnection(0); if (connection != null) { BTResult result = (BTResult)connection.GetOutputValue(); if (result == BTResult.SUCCESS) { BehaviourTreeRuntimeData.RemoveRunningNode(context, this); } else if (result == BTResult.RUNNING) { return(BTResult.RUNNING); } else { BehaviourTreeRuntimeData.AddRunningNode(context, this); return(BTResult.RUNNING); } } } return(BTResult.SUCCESS); }
/// <summary> /// Checks that the current behavior tree is valid and has a root node /// </summary> private void Start() { isValid = ValidateAndSetRootNode(); if (isValid) { BehaviourTreeRuntimeData.RegisterBehaviourTree(this); } }
private void Start() { behaviourTreeMap = BehaviourTreeRuntimeData.GetBehaviourTrees(); // Retreives the static dictionary from BehaviourTreeRuntimeData contextDataMap = BehaviourTreeRuntimeData.GetContextData(); // Retreives the static dictionary from BehaviourTreeRuntimeData }
/// <summary> /// Saves the starting position value. Initializes the <see cref="AISensor"/> and registers the agent in <see cref="BehaviourTreeRuntimeData"/> /// </summary> private void Start() { startPosition = transform.position; sensor.Initialize(this, navAgent); BehaviourTreeRuntimeData.RegisterAgentContext(behaviourTreeType, aiContext); }