• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# EBTStatus类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中EBTStatus的典型用法代码示例。如果您正苦于以下问题:C# EBTStatus类的具体用法?C# EBTStatus怎么用?C# EBTStatus使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



EBTStatus类属于命名空间,在下文中一共展示了EBTStatus类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: UpdateTransitions

        public static bool UpdateTransitions(Agent pAgent, BehaviorNode node, List<Transition> transitions, ref int nextStateId, EBTStatus result)
        {
            bool bTransitioned = false;

            if (transitions != null)
            {
                for (int i = 0; i < transitions.Count; ++i)
                {
                    Transition transition = transitions[i];

                    if (transition.Evaluate(pAgent))
                    {
                        nextStateId = transition.TargetStateId;
                        Debug.Check(nextStateId != -1);

                        //transition actions
                        transition.ApplyEffects(pAgent, Effector.EPhase.E_BOTH);

            #if !BEHAVIAC_RELEASE
                        if (Config.IsLoggingOrSocketing)
                        {
                            BehaviorTask.CHECK_BREAKPOINT(pAgent, node, "transition", EActionResult.EAR_none);
                        }
            #endif
                        bTransitioned = true;

                        break;
                    }
                }
            }

            return bTransitioned;
        }
开发者ID:wuzhen,项目名称:behaviac,代码行数:33,代码来源:State.cs


示例2: update

            protected override EBTStatus update(Agent pAgent, EBTStatus childStatus)
            {
                EBTStatus s = childStatus;
                Debug.Check(this.m_activeChildIndex < this.m_children.Count);

                // Keep going until a child behavior says its running.
                for (; ;)
                {
                    if (s == EBTStatus.BT_RUNNING)
                    {
                        int childIndex = this.m_set[this.m_activeChildIndex];
                        BehaviorTask pBehavior = this.m_children[childIndex];
                        s = pBehavior.exec(pAgent);
                    }

                    // If the child succeeds, or keeps running, do the same.
                    if (s != EBTStatus.BT_FAILURE)
                    {
                        return s;
                    }

                    // Hit the end of the array, job done!
                    ++this.m_activeChildIndex;

                    if (this.m_activeChildIndex >= this.m_children.Count)
                    {
                        return EBTStatus.BT_FAILURE;
                    }

                    s = EBTStatus.BT_RUNNING;
                }
            }
开发者ID:Just4F,项目名称:behaviac,代码行数:32,代码来源:Selectorstochastic.cs


示例3: decorate

            protected override EBTStatus decorate(EBTStatus status)
            {
                if (this.m_n > 0)
                {
                    this.m_n--;
                }

                if (this.m_n == 0)
                {
                    return EBTStatus.BT_SUCCESS;
                }

                Debug.Check(this.GetNode() is DecoratorLoopUntil);
                DecoratorLoopUntil pDecoratorLoopUntil = (DecoratorLoopUntil)(this.GetNode());

                if (pDecoratorLoopUntil.m_until)
                {
                    if (status == EBTStatus.BT_SUCCESS)
                    {
                        return EBTStatus.BT_SUCCESS;
                    }
                }
                else
                {
                    if (status == EBTStatus.BT_FAILURE)
                    {
                        return EBTStatus.BT_FAILURE;
                    }
                }

                return EBTStatus.BT_RUNNING;
            }
开发者ID:675492062,项目名称:behaviac,代码行数:32,代码来源:Decoratorloopuntil.cs


示例4: decorate

            protected override EBTStatus decorate(EBTStatus status)
            {
                Debug.Check(this.GetNode() is DecoratorLog);
                DecoratorLog pDecoratorLogNode = (DecoratorLog)(this.GetNode());
                behaviac.Debug.LogWarning(string.Format("DecoratorLogTask:{0}\n", pDecoratorLogNode.m_message));

                return status;
            }
开发者ID:675492062,项目名称:behaviac,代码行数:8,代码来源:Decoratorlog.cs


示例5: getResultOptionStr

        private string getResultOptionStr(EBTStatus status)
        {
            switch (status)
            {
                case EBTStatus.BT_SUCCESS: return "EBTStatus.BT_SUCCESS";
                case EBTStatus.BT_FAILURE: return "EBTStatus.BT_FAILURE";
                case EBTStatus.BT_RUNNING: return "EBTStatus.BT_RUNNING";
            }

            return "EBTStatus.BT_INVALID";
        }
开发者ID:675492062,项目名称:behaviac,代码行数:11,代码来源:ActionCsExporter.cs


示例6: decorate

            protected override EBTStatus decorate(EBTStatus status)
            {
                if (status == EBTStatus.BT_FAILURE)
                {
                    return EBTStatus.BT_SUCCESS;
                }

                if (status == EBTStatus.BT_SUCCESS)
                {
                    return EBTStatus.BT_FAILURE;
                }

                return status;
            }
开发者ID:Oswin2014,项目名称:Behavior_Tree-Practice-in-Unity,代码行数:14,代码来源:Decoratornot.cs


示例7: update

            protected override EBTStatus update(Agent pAgent, EBTStatus childStatus)
            {
                //Debug.Check(this.m_children.Count == 2);
                for(int i = 0; i < this.m_children.Count; ++i)
                {
                    BehaviorTask pBehavior = this.m_children[i];
                    EBTStatus s = pBehavior.exec(pAgent);

                    // If the child succeeds, succeeds
                    if (s == EBTStatus.BT_SUCCESS)
                    {
                        return s;
                    }

                    Debug.Check(s == EBTStatus.BT_FAILURE);
                }

                return EBTStatus.BT_FAILURE;
            }
开发者ID:Oswin2014,项目名称:Behavior_Tree-Practice-in-Unity,代码行数:19,代码来源:Or.cs


示例8: load

        protected override void load(int version, string agentType, List<property_t> properties)
        {
            base.load(version, agentType, properties);

            for (int i = 0; i < properties.Count; ++i)
            {
                property_t p = properties[i];
                if (p.name == "Method")
                {
                    if (!string.IsNullOrEmpty(p.value))
                    {
                        this.m_method = AgentMeta.ParseMethod(p.value);
                    }
                }
                else if (p.name == "ResultOption")
                {
                    if (p.value == "BT_INVALID")
                    {
                        m_resultOption = EBTStatus.BT_INVALID;
                    }
                    else if (p.value == "BT_FAILURE")
                    {
                        m_resultOption = EBTStatus.BT_FAILURE;
                    }
                    else if (p.value == "BT_RUNNING")
                    {
                        m_resultOption = EBTStatus.BT_RUNNING;
                    }
                    else
                    {
                        m_resultOption = EBTStatus.BT_SUCCESS;
                    }
                }
                else if (p.name == "ResultFunctor")
                {
                    if (p.value[0] != '\0')
                    {
                        this.m_resultFunctor = AgentMeta.ParseMethod(p.value); ;
                    }
                }
            }
        }
开发者ID:Just4F,项目名称:behaviac,代码行数:42,代码来源:Action.cs


示例9: update

            protected override EBTStatus update(Agent pAgent, EBTStatus childStatus)
            {
                bool bFirst = true;

                Debug.Check(this.m_activeChildIndex < this.m_children.Count);

                // Keep going until a child behavior says its running.
                for (; ; )
                {
                    EBTStatus s = childStatus;
                    if (!bFirst || s == EBTStatus.BT_RUNNING)
                    {
                        Debug.Check(this.m_status == EBTStatus.BT_INVALID ||
                            this.m_status == EBTStatus.BT_RUNNING);

                        BehaviorTask pBehavior = this.m_children[this.m_activeChildIndex];
                        s = pBehavior.exec(pAgent);
                    }

                    bFirst = false;

                    // If the child succeeds, or keeps running, do the same.
                    if (s != EBTStatus.BT_FAILURE)
                    {
                        return s;
                    }

                    // Hit the end of the array, job done!
                    ++this.m_activeChildIndex;
                    if (this.m_activeChildIndex >= this.m_children.Count)
                    {
                        return EBTStatus.BT_FAILURE;
                    }

                    if (!this.CheckPredicates(pAgent))
                    {
                        return EBTStatus.BT_FAILURE;
                    }
                }
            }
开发者ID:Oswin2014,项目名称:Behavior_Tree-Practice-in-Unity,代码行数:40,代码来源:Selector.cs


示例10: decorate

            protected override EBTStatus decorate(EBTStatus status)
            {
                if (this.m_n > 0)
                {
                    this.m_n--;

                    if (this.m_n == 0)
                    {
                        return EBTStatus.BT_SUCCESS;
                    }

                    return EBTStatus.BT_FAILURE;
                }

                if (this.m_n == -1)
                {
                    return EBTStatus.BT_FAILURE;
                }

                Debug.Check(this.m_n == 0);

                return EBTStatus.BT_SUCCESS;
            }
开发者ID:pjkui,项目名称:behaviac,代码行数:23,代码来源:Decoratorfailureuntil.cs


示例11: Execute

        public EBTStatus Execute(Agent pAgent, EBTStatus childStatus)
        {
            EBTStatus result = EBTStatus.BT_SUCCESS;

            if (this.m_method != null)
            {
                if (this.m_resultOption != EBTStatus.BT_INVALID)
                {
                    this.m_method.Run(pAgent);

                    result = this.m_resultOption;
                }
                else
                {
                    if (this.m_resultFunctor != null)
                    {
                        IValue returnValue = this.m_resultFunctor.GetIValue(pAgent, this.m_method);

                        result = ((TValue<EBTStatus>)returnValue).value;
                    }
                    else
                    {
                        IValue returnValue = this.m_method.GetIValue(pAgent);

                        Debug.Check(returnValue is TValue<EBTStatus>, "method's return type is not EBTStatus");

                        result = ((TValue<EBTStatus>)returnValue).value;
                    }
                }
            }
            else
            {
                result = this.update_impl(pAgent, childStatus);
            }

            return result;
        }
开发者ID:Just4F,项目名称:behaviac,代码行数:37,代码来源:Action.cs


示例12: SelectorUpdate

        public EBTStatus SelectorUpdate(Agent pAgent, EBTStatus childStatus, ref int activeChildIndex, List<BehaviorTask> children)
        {
            EBTStatus s = childStatus;

            for (; ;)
            {
                Debug.Check(activeChildIndex < children.Count);

                if (s == EBTStatus.BT_RUNNING)
                {
                    BehaviorTask pBehavior = children[activeChildIndex];
                    if (this.CheckIfInterrupted(pAgent))
                    {
                        return EBTStatus.BT_FAILURE;
                    }

                    s = pBehavior.exec(pAgent);
                }

                // If the child fails, or keeps running, do the same.
                if (s != EBTStatus.BT_FAILURE)
                {
                    return s;
                }

                // Hit the end of the array, job done!
                ++activeChildIndex;

                if (activeChildIndex >= children.Count)
                {
                    return EBTStatus.BT_FAILURE;
                }

                s = EBTStatus.BT_RUNNING;
            }
        }
开发者ID:XyzalZhang,项目名称:behaviac,代码行数:36,代码来源:Selector.cs


示例13: exec

        public EBTStatus exec(Agent pAgent, EBTStatus childStatus)
        {
            #if !BEHAVIAC_RELEASE
            Debug.Check(this.m_node == null || this.m_node.IsValid(pAgent, this),
                        string.Format("Agent In BT:{0} while the Agent used for: {1}", this.m_node.GetAgentType(), pAgent.GetClassTypeName()));
            #endif//#if !BEHAVIAC_RELEASE
            bool bEnterResult = false;

            if (this.m_status == EBTStatus.BT_RUNNING)
            {
                bEnterResult = true;
            }
            else
            {
                //reset it to invalid when it was success/failure
                this.m_status = EBTStatus.BT_INVALID;
                bEnterResult = this.onenter_action(pAgent);
            }

            if (bEnterResult)
            {
            #if !BEHAVIAC_RELEASE

                if (Config.IsLoggingOrSocketing)
                {
                    string btStr = BehaviorTask.GetTickInfo(pAgent, this, "update");

                    //empty btStr is for internal BehaviorTreeTask
                    if (!string.IsNullOrEmpty(btStr))
                    {
                        LogManager.Instance.Log(pAgent, btStr, EActionResult.EAR_none, LogMode.ELM_tick);
                    }
                }

            #endif
                bool bValid = this.CheckParentUpdatePreconditions(pAgent);

                if (bValid)
                {
                    this.m_status = this.update_current(pAgent, childStatus);
                }
                else
                {
                    this.m_status = EBTStatus.BT_FAILURE;

                    if (this.GetCurrentTask() != null)
                    {
                        this.update_current(pAgent, EBTStatus.BT_FAILURE);
                    }
                }

                if (this.m_status != EBTStatus.BT_RUNNING)
                {
                    //clear it

                    this.onexit_action(pAgent, this.m_status);

                    //this node is possibly ticked by its parent or by the topBranch who records it as currrent node
                    //so, we can't here reset the topBranch's current node
                }
                else
                {
                    BranchTask tree = this.GetTopManageBranchTask();

                    if (tree != null)
                    {
                        tree.SetCurrentTask(this);
                    }
                }
            }
            else
            {
                this.m_status = EBTStatus.BT_FAILURE;
            }

            return this.m_status;
        }
开发者ID:wuzhen,项目名称:behaviac,代码行数:77,代码来源:BehaviorTree_task.cs


示例14: update_current

        protected override EBTStatus update_current(Agent pAgent, EBTStatus childStatus)
        {
            Debug.Check(this.m_node != null);
            Debug.Check(this.m_node is BehaviorTree);
            BehaviorTree tree = (BehaviorTree)this.m_node;

            EBTStatus status = EBTStatus.BT_RUNNING;

            if (tree.IsFSM)
            {
                status = this.update(pAgent, childStatus);
            }
            else
            {
                status = base.update_current(pAgent, childStatus);
            }

            return status;
        }
开发者ID:wuzhen,项目名称:behaviac,代码行数:19,代码来源:BehaviorTree_task.cs


示例15: update

        protected override EBTStatus update(Agent pAgent, EBTStatus childStatus)
        {
            Debug.Check(this.m_node != null);
            Debug.Check(this.m_root != null);

            if (childStatus != EBTStatus.BT_RUNNING)
            {
                return childStatus;
            }

            EBTStatus status = EBTStatus.BT_INVALID;

            status = base.update(pAgent, childStatus);

            Debug.Check(status != EBTStatus.BT_INVALID);

            return status;
        }
开发者ID:wuzhen,项目名称:behaviac,代码行数:18,代码来源:BehaviorTree_task.cs


示例16: onexit

        protected override void onexit(Agent pAgent, EBTStatus s)
        {
            //Debug.Check(this.m_node != null);
            //this.m_node.UnInstantiatePars(pAgent);

            pAgent.LogReturnTree(this.GetName());
            base.onexit(pAgent, s);
        }
开发者ID:wuzhen,项目名称:behaviac,代码行数:8,代码来源:BehaviorTree_task.cs


示例17: resume

        public EBTStatus resume(Agent pAgent, EBTStatus status)
        {
            EBTStatus s = base.resume_branch(pAgent, status);

            return s;
        }
开发者ID:wuzhen,项目名称:behaviac,代码行数:6,代码来源:BehaviorTree_task.cs


示例18: update

            protected override EBTStatus update(Agent pAgent, EBTStatus childStatus)
            {
                Debug.Check(this.GetNode() is Action, "node is not an Action");
                Action pActionNode = (Action)(this.GetNode());

                if (!this.CheckPredicates(pAgent))
                {
                    return pActionNode.m_resultPreconditionFail;
                }

                EBTStatus result = EBTStatus.BT_SUCCESS;

                if (pActionNode.m_method != null)
                {
                    ParentType pt = pActionNode.m_method.GetParentType();
                    Agent pParent = pAgent;
                    if (pt == ParentType.PT_INSTANCE)
                    {
                        pParent = Agent.GetInstance(pActionNode.m_method.GetInstanceNameString(), pParent.GetContextId());
                        Debug.Check(pParent != null || Utils.IsStaticClass(pActionNode.m_method.GetInstanceNameString()));
                    }

                    int nodeId = this.GetId();
                    SetNodeId(nodeId);

                    object returnValue = pActionNode.m_method.run(pParent, pAgent);

                    if (pActionNode.m_resultOption != EBTStatus.BT_INVALID)
                    {
                        result = pActionNode.m_resultOption;
                    }
                    else if (pActionNode.m_resultFunctor != null)
                    {
                        ParentType pt1 = pActionNode.m_resultFunctor.GetParentType();
                        Agent pParentCheckResult = pAgent;
                        if (pt1 == ParentType.PT_INSTANCE)
                        {
                            pParentCheckResult = Agent.GetInstance(pActionNode.m_resultFunctor.GetInstanceNameString(), pParent.GetContextId());
                            Debug.Check(pParentCheckResult != null || Utils.IsStaticClass(pActionNode.m_resultFunctor.GetInstanceNameString()));
                        }

                        result = (EBTStatus)pActionNode.m_resultFunctor.run(pParentCheckResult, pAgent, returnValue);
                    }
                    else
                    {
                        Debug.Check(returnValue is EBTStatus, "method's return type is not EBTStatus");
                        result = (EBTStatus)returnValue;
                    }

                    ClearNodeId();
                }
                else
                {
                    result = pActionNode.update_impl(pAgent, childStatus);
                }

                return result;
            }
开发者ID:godsonhand,项目名称:behaviac,代码行数:58,代码来源:Action.cs


示例19: load

        protected override void load(int version, string agentType, List<property_t> properties)
        {
            base.load(version, agentType, properties);

            foreach (property_t p in properties)
            {
                if (p.name == "Method")
                {
                    if (!string.IsNullOrEmpty(p.value))
                    {
                        this.m_method = Action.LoadMethod(p.value);
                    }//if (p.value[0] != '\0')
                }
                else if (p.name == "ResultOption")
                {
                    if (p.value == "BT_INVALID")
                    {
                        m_resultOption = EBTStatus.BT_INVALID;
                    }
                    else if (p.value == "BT_FAILURE")
                    {
                        m_resultOption = EBTStatus.BT_FAILURE;
                    }
                    else if (p.value == "BT_RUNNING")
                    {
                        m_resultOption = EBTStatus.BT_RUNNING;
                    }
                    else
                    {
                        m_resultOption = EBTStatus.BT_SUCCESS;
                    }
                }
                else if (p.name == "ResultFunctor")
                {
                    if (p.value[0] != '\0')
                    {
                        this.m_resultFunctor = Action.LoadMethod(p.value);
                    }
                }
                else if (p.name == "PreconditionFailResult")
                {
                    if (p.value == "BT_FAILURE")
                    {
                        m_resultPreconditionFail = EBTStatus.BT_FAILURE;
                    }
                    else if (p.value == "BT_BT_SUCCESS")
                    {
                        m_resultPreconditionFail = EBTStatus.BT_SUCCESS;
                    }
                    else
                    {
                        Debug.Check(false);
                    }
                }
                else
                {
                    //Debug.Check(0, "unrecognised property %s", p.name);
                }
            }
        }
开发者ID:godsonhand,项目名称:behaviac,代码行数:60,代码来源:Action.cs


示例20: update

            protected override EBTStatus update(Agent pAgent, EBTStatus childStatus)
            {
                Debug.Check(childStatus == EBTStatus.BT_RUNNING);
                Debug.Check(this.m_node is WaitFramesState, "node is not an WaitFramesState");
                WaitFramesState pStateNode = (WaitFramesState)this.m_node;

                if (Workspace.Instance.FrameSinceStartup - this.m_start + 1 >= this.m_frames)
                {
                    pStateNode.Update(pAgent, out this.m_nextStateId);
                    return EBTStatus.BT_SUCCESS;
                }

                return EBTStatus.BT_RUNNING;
            }
开发者ID:675492062,项目名称:behaviac,代码行数:14,代码来源:WaitframesState.cs



注:本文中的EBTStatus类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# EC2UnmarshallerContext类代码示例发布时间:2022-05-24
下一篇:
C# EA类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap