Inheritance: behaviac.DecoratorNode
示例#1
0
        public void LogPlanForEachEnd(Agent a, DecoratorIterator pForEach, int index, int count, string result)
        {
#if !BEHAVIAC_RELEASE
            if (Config.IsLoggingOrSocketing)
            {
                string ni = BehaviorTask.GetTickInfo(a, pForEach, null);
                LogManager.Log("[plan_foreach_end]{0} {1} {2} {3}\n", ni, index, count, result);
            }
#endif
        }
示例#2
0
        protected override bool onenter(Agent pAgent)
        {
            bool bOk = base.onenter(pAgent);

            DecoratorIterator pNode = this.m_node as DecoratorIterator;
            int count = 0;
            bOk = pNode.IterateIt(pAgent, this.m_index, ref count);

            return bOk;
        }
示例#3
0
        public void LogPlanForEachBegin(Agent a, DecoratorIterator pForEach, int index, int count)
        {
#if !BEHAVIAC_RELEASE
            if (Config.IsLoggingOrSocketing)
            {
                string ni = BehaviorTask.GetTickInfo(a, pForEach, null);
                LogManager.Log("[plan_foreach_begin]{0} {1} {2}\n", ni, index, count);
                a.Variables.Log(a, true);
            }
#endif
        }
示例#4
0
        public override bool decompose(BehaviorNode node, PlannerTaskComplex seqTask, int depth, Planner planner)
        {
            DecoratorIterator pForEach = (DecoratorIterator)node;
            bool bOk        = false;
            int  childCount = pForEach.GetChildrenCount();

            Debug.Check(childCount == 1);
            BehaviorNode childNode = pForEach.GetChild(0);

            bool bGoOn = true;
            int  count = 0;
            int  index = 0;

            while (bGoOn)
            {
                int depth2 = planner.GetAgent().Variables.Depth;
                using (AgentState currentState = planner.GetAgent().Variables.Push(false))
                {
                    bGoOn = pForEach.IterateIt(planner.GetAgent(), index, ref count);

                    if (bGoOn)
                    {
                        planner.LogPlanForEachBegin(planner.GetAgent(), pForEach, index, count);
                        PlannerTask childTask = planner.decomposeNode(childNode, depth);
                        planner.LogPlanForEachEnd(planner.GetAgent(), pForEach, index, count, childTask != null ? "success" : "failure");

                        if (childTask != null)
                        {
                            Debug.Check(seqTask is PlannerTaskIterator);
                            PlannerTaskIterator pForEachTask = seqTask as PlannerTaskIterator;
                            pForEachTask.Index = index;

                            seqTask.AddChild(childTask);
                            bOk = true;
                            break;
                        }

                        index++;
                    }
                }

                Debug.Check(planner.GetAgent().Variables.Depth == depth2);
            }

            return(bOk);
        }
示例#5
0
        public void LogPlanForEachEnd(Agent a, DecoratorIterator pForEach, int index, int count, string result)
        {
#if !BEHAVIAC_RELEASE

            if (Config.IsLoggingOrSocketing)
            {
                string ni = BehaviorTask.GetTickInfo(a, pForEach, null);
                LogManager.Instance.Log("[plan_foreach_end]{0} {1} {2} {3}\n", ni, index, count, result);
            }

#endif
        }
示例#6
0
        public void LogPlanForEachBegin(Agent a, DecoratorIterator pForEach, int index, int count)
        {
#if !BEHAVIAC_RELEASE

            if (Config.IsLoggingOrSocketing)
            {
                string ni = BehaviorTask.GetTickInfo(a, pForEach, null);
                LogManager.Instance.Log("[plan_foreach_begin]{0} {1} {2}\n", ni, index, count);
                a.Variables.Log(a, true);
            }

#endif
        }