コード例 #1
0
ファイル: Context.cs プロジェクト: raptoravis/behaviac1
        /**
         * bind 'agentInstanceName' to 'pAgentInstance'.
         * 'agentInstanceName' should have been registered to the class of 'pAgentInstance' or its parent class.
         *
         * @sa RegisterName
         */
        public bool BindInstance(Agent pAgentInstance, string agentInstanceName)
        {
            if (string.IsNullOrEmpty(agentInstanceName))
            {
                agentInstanceName = pAgentInstance.GetType().FullName;
            }

            if (Agent.IsNameRegistered(agentInstanceName))
            {
                Debug.Check(GetInstance(agentInstanceName) == null, "the name has been bound to an instance already!");

                string className = Agent.GetRegisteredClassName(agentInstanceName);

                if (Agent.IsDerived(pAgentInstance, className))
                {
                    m_namedAgents[agentInstanceName] = pAgentInstance;

                    return(true);
                }
            }
            else
            {
                Debug.Check(false);
            }

            return(false);
        }
コード例 #2
0
ファイル: BehaviorTree.cs プロジェクト: raptoravis/behaviac1
        public virtual bool IsValid(Agent pAgent, BehaviorTask pTask)
        {
#if !BEHAVIAC_RELEASE
            Debug.Check(!string.IsNullOrEmpty(this.m_agentType));

            return(Agent.IsDerived(pAgent, this.m_agentType));
#else
            return(true);
#endif//#if !BEHAVIAC_RELEASE
        }
コード例 #3
0
ファイル: Context.cs プロジェクト: TonyDongGuaPi/joework
 public bool BindInstance(Agent pAgentInstance, string agentInstanceName)
 {
     if (string.IsNullOrEmpty(agentInstanceName))
     {
         agentInstanceName = pAgentInstance.GetType().get_FullName();
     }
     if (Agent.IsNameRegistered(agentInstanceName))
     {
         string registeredClassName = Agent.GetRegisteredClassName(agentInstanceName);
         if (Agent.IsDerived(pAgentInstance, registeredClassName))
         {
             this.m_namedAgents.set_Item(agentInstanceName, pAgentInstance);
             return(true);
         }
     }
     return(false);
 }