private void ResetMemoryInternal(MyBehaviorTree behaviorTree, MyPerTreeBotMemory treeMemory) { for (int i = 0; i < behaviorTree.TotalNodeCount; i++) { treeMemory.AddNodeMemory(behaviorTree.GetNodeByIndex(i).GetNewMemoryObject()); } }
public bool ValidateMemoryForBehavior(MyBehaviorTree behaviorTree) { bool isValid = true; if (CurrentTreeBotMemory.NodesMemoryCount != behaviorTree.TotalNodeCount) isValid = false; else { for (int i = 0; i < CurrentTreeBotMemory.NodesMemoryCount; i++) { var nodeMemory = CurrentTreeBotMemory.GetNodeMemoryByIndex(i); if (nodeMemory.GetType() != behaviorTree.GetNodeByIndex(i).MemoryType) { isValid = false; break; } } } return isValid; }