public override MyBehaviorTreeState Tick(IMyBot bot, MyPerTreeBotMemory botTreeMemory)
        {
            var decoratorMemory = botTreeMemory.GetNodeMemoryByIndex(MemoryIndex) as MyBehaviorTreeDecoratorNodeMemory;

            if (m_child == null)
            {
                return(m_defaultReturnValue);
            }

            if (decoratorMemory.ChildState != MyBehaviorTreeState.RUNNING)
            {
                m_decoratorLogic.Update(decoratorMemory.DecoratorLogicMemory);
                if (m_decoratorLogic.CanRun(decoratorMemory.DecoratorLogicMemory))
                {
                    return(TickChild(bot, botTreeMemory, decoratorMemory));
                }
                else
                {
                    if (IsRunningStateSource)
                    {
                        bot.BotMemory.ProcessLastRunningNode(this);
                    }

                    botTreeMemory.GetNodeMemoryByIndex(MemoryIndex).NodeState = m_defaultReturnValue;
                    return(m_defaultReturnValue);
                }
            }
            else
            {
                return(TickChild(bot, botTreeMemory, decoratorMemory));
            }
        }
        public override MyBehaviorTreeState Tick(IMyBot bot, MyPerTreeBotMemory botTreeMemory)
        {
            var decoratorMemory = botTreeMemory.GetNodeMemoryByIndex(MemoryIndex) as MyBehaviorTreeDecoratorNodeMemory;

            if (m_child == null)
            {
                return(m_defaultReturnValue);
            }

            if (decoratorMemory.ChildState != MyBehaviorTreeState.RUNNING)
            {
                m_decoratorLogic.Update(decoratorMemory.DecoratorLogicMemory);
                if (m_decoratorLogic.CanRun(decoratorMemory.DecoratorLogicMemory))
                {
                    MyBehaviorTreeState state = TickChild(bot, botTreeMemory, decoratorMemory);
                    RecordRunningNodeName(state);
                    return(state);
                }
                else
                {
                    if (IsRunningStateSource)
                    {
                        bot.BotMemory.ProcessLastRunningNode(this);
                    }

                    botTreeMemory.GetNodeMemoryByIndex(MemoryIndex).NodeState = m_defaultReturnValue;
                    if (Sandbox.Engine.Utils.MyDebugDrawSettings.DEBUG_DRAW_BOTS && m_defaultReturnValue == MyBehaviorTreeState.RUNNING)
                    {
                        m_runningActionName = ParentName + m_decoratorLogicName;
                    }

                    return(m_defaultReturnValue);
                }
            }
            else
            {
                MyBehaviorTreeState state = TickChild(bot, botTreeMemory, decoratorMemory);
                RecordRunningNodeName(state);
                return(state);
                //return TickChild(bot, botTreeMemory, decoratorMemory);
            }
        }