/** * Resets the evaluation of all the guards. This method leaves all the guard * executors ({@link #guardsExecutors}) ready to start again the evaluation * of the guards. It internally terminates the IBTExecutor of each guard, * creates a new one, and then ticks it. */ private void resetGuardsEvaluation() { for (int i = 0; i < _guardsExecutors.Count; i++) { BTExecutor guardExecutor = _guardsExecutors[i]; if (guardExecutor != null) { guardExecutor.Terminate(); guardsResults[i] = Status.Running; var newExecutor = new BTExecutor(guardExecutor.GetBehaviourTree(), Context); newExecutor.CopyTasksStates(guardExecutor); newExecutor.Tick(); _guardsExecutors[i] = newExecutor; } } }