private void SendDataToTool(IMyBot bot, MyPerTreeBotMemory botTreeMemory) { if (!this.DebugIsCurrentTreeVerified || (this.DebugLastWindowHandle.ToInt32() != this.m_toolWindowHandle.ToInt32())) { IntPtr wParam = new IntPtr(this.m_BTDataByName[this.m_botBehaviorIds[bot]].BehaviorTree.GetHashCode()); WinApi.PostMessage(this.m_toolWindowHandle, 0x403, wParam, IntPtr.Zero); this.DebugIsCurrentTreeVerified = true; this.DebugLastWindowHandle = new IntPtr(this.m_toolWindowHandle.ToInt32()); } WinApi.PostMessage(this.m_toolWindowHandle, 0x401, IntPtr.Zero, IntPtr.Zero); for (int i = 0; i < botTreeMemory.NodesMemoryCount; i++) { MyBehaviorTreeState nodeState = botTreeMemory.GetNodeMemoryByIndex(i).NodeState; if (nodeState != MyBehaviorTreeState.NOT_TICKED) { WinApi.PostMessage(this.m_toolWindowHandle, 0x400, new IntPtr((long)((ulong)i)), new IntPtr((int)nodeState)); } } WinApi.PostMessage(this.m_toolWindowHandle, 0x402, IntPtr.Zero, IntPtr.Zero); }
public override void PostTick(IMyBot bot, MyPerTreeBotMemory botTreeMemory) { base.PostTick(bot, botTreeMemory); var decoratorMemory = botTreeMemory.GetNodeMemoryByIndex(MemoryIndex) as MyBehaviorTreeDecoratorNodeMemory; if (decoratorMemory.ChildState != MyBehaviorTreeState.NOT_TICKED) { decoratorMemory.PostTickMemory(); if (m_child != null) { m_child.PostTick(bot, botTreeMemory); } } else { if (IsRunningStateSource) { decoratorMemory.PostTickMemory(); } } }
public override MyBehaviorTreeState Tick(IMyBot bot, MyPerTreeBotMemory botTreeMemory) { if (bot.ActionCollection.ReturnsRunning(this.m_actionName)) { bot.BotMemory.ProcessLastRunningNode(this); } MyBehaviorTreeNodeMemory nodeMemoryByIndex = botTreeMemory.GetNodeMemoryByIndex(base.MemoryIndex); if (!nodeMemoryByIndex.InitCalled) { nodeMemoryByIndex.InitCalled = true; if (bot.ActionCollection.ContainsInitAction(this.m_actionName)) { bot.ActionCollection.PerformInitAction(bot, this.m_actionName); } } MyBehaviorTreeState state = bot.ActionCollection.PerformAction(bot, this.m_actionName, this.m_parameters); nodeMemoryByIndex.NodeState = state; return(state); }
public override void PostTick(IMyBot bot, MyPerTreeBotMemory botTreeMemory) { base.PostTick(bot, botTreeMemory); MyBehaviorTreeDecoratorNodeMemory nodeMemoryByIndex = botTreeMemory.GetNodeMemoryByIndex(base.MemoryIndex) as MyBehaviorTreeDecoratorNodeMemory; if (nodeMemoryByIndex.ChildState == MyBehaviorTreeState.NOT_TICKED) { if (this.IsRunningStateSource) { nodeMemoryByIndex.PostTickMemory(); } } else { nodeMemoryByIndex.PostTickMemory(); if (this.m_child != null) { this.m_child.PostTick(bot, botTreeMemory); } } }
public override MyBehaviorTreeState Tick(IMyBot bot, MyPerTreeBotMemory botTreeMemory) { bot.BotMemory.RememberNode(m_child.MemoryIndex); if (Sandbox.Engine.Utils.MyDebugDrawSettings.DEBUG_DRAW_BOTS) { // store this old memory bot.LastBotMemory = bot.BotMemory.Clone(); } var state = m_child.Tick(bot, botTreeMemory); botTreeMemory.GetNodeMemoryByIndex(MemoryIndex).NodeState = state; RecordRunningNodeName(bot, state); if (state != MyBehaviorTreeState.RUNNING) { bot.BotMemory.ForgetNode(); } return(state); }
private void SendDataToTool(IMyBot bot, MyPerTreeBotMemory botTreeMemory) { if (!DebugIsCurrentTreeVerified || DebugLastWindowHandle.ToInt32() != m_toolWindowHandle.ToInt32()) { int hash = bot.BehaviorTree.GetHashCode(); IntPtr toSend = new IntPtr(hash); WinApi.PostMessage(m_toolWindowHandle, MyWMCodes.BEHAVIOR_TOOL_VALIDATE_TREE, toSend, IntPtr.Zero); DebugIsCurrentTreeVerified = true; DebugLastWindowHandle = new IntPtr(m_toolWindowHandle.ToInt32()); } WinApi.PostMessage(m_toolWindowHandle, MyWMCodes.BEHAVIOR_TOOL_CLEAR_NODES, IntPtr.Zero, IntPtr.Zero); for (int i = 0; i < botTreeMemory.NodesMemoryCount; ++i) { var state = botTreeMemory.GetNodeMemoryByIndex(i).NodeState; if (state == MyBehaviorTreeState.NOT_TICKED) { continue; } WinApi.PostMessage(m_toolWindowHandle, MyWMCodes.BEHAVIOR_TOOL_SET_DATA, new IntPtr((uint)i), new IntPtr((int)state)); } WinApi.PostMessage(m_toolWindowHandle, MyWMCodes.BEHAVIOR_TOOL_END_SENDING_DATA, IntPtr.Zero, IntPtr.Zero); }
public virtual void PostTick(IMyBot bot, MyPerTreeBotMemory nodesMemory) { }
public abstract MyBehaviorTreeState Tick(IMyBot bot, MyPerTreeBotMemory nodesMemory);