當前位置: 首頁>>代碼示例>>C#>>正文


C# Agent.IsMasked方法代碼示例

本文整理匯總了C#中Agent.IsMasked方法的典型用法代碼示例。如果您正苦於以下問題:C# Agent.IsMasked方法的具體用法?C# Agent.IsMasked怎麽用?C# Agent.IsMasked使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Agent的用法示例。


在下文中一共展示了Agent.IsMasked方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: GetTickInfo

        public static string GetTickInfo(Agent pAgent, BehaviorTask b, string action)
        {
            #if !BEHAVIAC_RELEASE
            if (Config.IsLoggingOrSocketing)
            {
                if (pAgent != null && pAgent.IsMasked())
                {
                    //BEHAVIAC_PROFILE("GetTickInfo", true);

                    string bClassName = b.GetClassNameString();

                    //filter out intermediate bt, whose class name is empty
                    if (!string.IsNullOrEmpty(bClassName))
                    {
                        int nodeId = b.GetId();
                        BehaviorTreeTask bt = pAgent != null ? pAgent.btgetcurrent() : null;

                        //TestBehaviorGroup\scratch.xml.EventetTask[0]:enter
                        string bpstr = "";
                        if (bt != null)
                        {
                            string btName = bt.GetName();

                            bpstr = string.Format("{0}.xml->", btName);
                        }

                        bpstr += string.Format("{0}[{1}]", bClassName, nodeId);

                        if (!string.IsNullOrEmpty(action))
                        {
                            bpstr += string.Format(":{0}", action);
                        }

                        return bpstr;
                    }
                }
            }
            #endif
            return string.Empty;
        }
開發者ID:Oswin2014,項目名稱:Behavior_Tree-Practice-in-Unity,代碼行數:40,代碼來源:BehaviorTree_task.cs

示例2: Log

        //action
        public void Log(Agent pAgent, string btMsg, EActionResult actionResult, LogMode mode)
        {
#if !BEHAVIAC_RELEASE

            if (Config.IsLoggingOrSocketing)
            {
                //BEHAVIAC_PROFILE("LogManager.Instance.LogAction");
                if (!System.Object.ReferenceEquals(pAgent, null) && pAgent.IsMasked())
                {
                    if (!string.IsNullOrEmpty(btMsg))
                    {
                        string agentClassName = pAgent.GetClassTypeName();

                        agentClassName = agentClassName.Replace(".", "::");

                        string agentName = agentClassName;
                        agentName += "#";
                        agentName += pAgent.GetName();

                        string actionResultStr = "";

                        if (actionResult == EActionResult.EAR_success)
                        {
                            actionResultStr = "success";
                        }
                        else if (actionResult == EActionResult.EAR_failure)
                        {
                            actionResultStr = "failure";
                        }
                        else if (actionResult == EActionResult.EAR_all)
                        {
                            actionResultStr = "all";
                        }
                        else
                        {
                            //although actionResult can be EAR_none or EAR_all, but, as this is the real result of an action
                            //it can only be success or failure
                            //when it is EAR_none, it is for update
                            if (actionResult == behaviac.EActionResult.EAR_none && mode == behaviac.LogMode.ELM_tick)
                            {
                                actionResultStr = "running";
                            }
                            else
                            {
                                actionResultStr = "none";
                            }
                        }

                        if (mode == LogMode.ELM_continue)
                        {
                            //[continue]Ship.Ship_1 ships\suicide.xml.BehaviorTreeTask[0]:enter [all/success/failure] [1]
                            int count = Workspace.Instance.GetActionCount(btMsg);
                            Debug.Check(count > 0);
                            string buffer = string.Format("[continue]{0} {1} [{2}] [{3}]\n", agentName, btMsg, actionResultStr, count);

                            Output(pAgent, buffer);
                        }
                        else if (mode == LogMode.ELM_breaked)
                        {
                            //[breaked]Ship.Ship_1 ships\suicide.xml.BehaviorTreeTask[0]:enter [all/success/failure] [1]
                            int count = Workspace.Instance.GetActionCount(btMsg);
                            Debug.Check(count > 0);
                            string buffer = string.Format("[breaked]{0} {1} [{2}] [{3}]\n", agentName, btMsg, actionResultStr, count);

                            Output(pAgent, buffer);
                        }
                        else if (mode == LogMode.ELM_tick)
                        {
                            //[tick]Ship.Ship_1 ships\suicide.xml.BehaviorTreeTask[0]:enter [all/success/failure] [1]
                            //[tick]Ship.Ship_1 ships\suicide.xml.BehaviorTreeTask[0]:update [1]
                            //[tick]Ship.Ship_1 ships\suicide.xml.Selector[1]:enter [all/success/failure] [1]
                            //[tick]Ship.Ship_1 ships\suicide.xml.Selector[1]:update [1]
                            int count = Workspace.Instance.UpdateActionCount(btMsg);

                            string buffer = string.Format("[tick]{0} {1} [{2}] [{3}]\n", agentName, btMsg, actionResultStr, count);

                            Output(pAgent, buffer);
                        }
                        else if (mode == LogMode.ELM_jump)
                        {
                            string buffer = string.Format("[jump]{0} {1}\n", agentName, btMsg);

                            Output(pAgent, buffer);
                        }
                        else if (mode == LogMode.ELM_return)
                        {
                            string buffer = string.Format("[return]{0} {1}\n", agentName, btMsg);

                            Output(pAgent, buffer);
                        }
                        else
                        {
                            Debug.Check(false);
                        }
                    }
                }
            }

#endif
//.........這裏部分代碼省略.........
開發者ID:Just4F,項目名稱:behaviac,代碼行數:101,代碼來源:LogManager.cs

示例3: GetTickInfo

        public static string GetTickInfo(Agent pAgent, BehaviorNode n, string action)
        {
            #if !BEHAVIAC_RELEASE

            if (Config.IsLoggingOrSocketing)
            {
                if (pAgent != null && pAgent.IsMasked())
                {
                    //BEHAVIAC_PROFILE("GetTickInfo", true);

                    string bClassName = n.GetClassNameString();

                    //filter out intermediate bt, whose class name is empty
                    if (!string.IsNullOrEmpty(bClassName))
                    {
                        string btName = GetParentTreeName(n);

                        string bpstr = "";

                        if (!string.IsNullOrEmpty(btName))
                        {
                            bpstr = string.Format("{0}.xml->", btName);
                        }

                        int nodeId = n.GetId();
                        bpstr += string.Format("{0}[{1}]", bClassName, nodeId);

                        if (!string.IsNullOrEmpty(action))
                        {
                            bpstr += string.Format(":{0}", action);
                        }

                        return bpstr;
                    }
                }
            }

            #endif
            return string.Empty;
        }
開發者ID:wuzhen,項目名稱:behaviac,代碼行數:40,代碼來源:BehaviorTree_task.cs

示例4: Log

        //property
        public static void Log(Agent pAgent, string typeName, string varName, string value)
        {
            #if !BEHAVIAC_RELEASE
            if (Config.IsLoggingOrSocketing)
            {
                //BEHAVIAC_PROFILE("LogManager.LogVar");

                if (!System.Object.ReferenceEquals(pAgent, null) && pAgent.IsMasked())
                {
                    string agentClassName = pAgent.GetClassTypeName();
                    string agentInstanceName = pAgent.GetName();

                    agentClassName = agentClassName.Replace(".", "::");
                    agentInstanceName = agentInstanceName.Replace(".", "::");

                    //[property]WorldState.World WorldState.time.276854364
                    //[property]Ship.Ship_1 GameObject.HP.100
                    //[property]Ship.Ship_1 GameObject.age.0
                    //[property]Ship.Ship_1 GameObject.speed.0.000000
                    string buffer;

                    bool bIsPar = Utils.IsParVar(varName);

                    if (bIsPar)
                    {
                        string tn = typeName;
                        //filter out "signed "
                        tn.Replace("signed ", "");

                        buffer = string.Format("[property]{0}#{1} {2} {3}->{4}\n", agentClassName, agentInstanceName, tn, varName, value);
                    }
                    else
                    {
                        buffer = string.Format("[property]{0}#{1} {2}->{3}\n", agentClassName, agentInstanceName, varName, value);
                    }

                    Output(pAgent, buffer);
                    SocketUtils.SendText(buffer);
                }
            }
            #endif
        }
開發者ID:nusus,項目名稱:behaviac,代碼行數:43,代碼來源:LogManager.cs


注:本文中的Agent.IsMasked方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。