public BTRoot CreateBehaviourTree( int iId )
		{
			if( iId <= 0 )
			{
				return null;
			}

			BTRoot root = new BTRoot( iId );
		    if (null == m_Config)
		    {
		        m_Config = ConfigManager.Instance.GetAIConfigTable();
		    }
            ParseBTXml(root, m_Config);
			return root;
		}
示例#2
0
        public BTRoot CreateBehaviourTree(int iId)
        {
            if (iId <= 0)
            {
                return(null);
            }

            BTRoot root = new BTRoot(iId);

            if (null == m_Config)
            {
                m_Config = ConfigManager.Instance.GetAIConfigTable();
            }
            ParseBTXml(root, m_Config);
            return(root);
        }
		private void ParseBTXml( BTRoot root, XElement xml )
		{
			IEnumerable<XElement> behaviorTrees = xml.Elements( BTDataKey.BEHAVIOUR_TREE_ROOT );
			if( null == behaviorTrees )
			{
				return;
			}

			foreach( XElement element in behaviorTrees )
			{
				int iID = 0;
				int.TryParse( element.Attribute( BTDataKey.BEHAVIOUR_TREE_ID ).Value, out iID );
				if( iID != root.ID )
				{
					continue;
				}

				ParseBTNode( root, element );
				break;
			}
		}
示例#4
0
        private void ParseBTXml(BTRoot root, XElement xml)
        {
            IEnumerable <XElement> behaviorTrees = xml.Elements(BTDataKey.BEHAVIOUR_TREE_ROOT);

            if (null == behaviorTrees)
            {
                return;
            }

            foreach (XElement element in behaviorTrees)
            {
                int iID = 0;
                int.TryParse(element.Attribute(BTDataKey.BEHAVIOUR_TREE_ID).Value, out iID);
                if (iID != root.ID)
                {
                    continue;
                }

                ParseBTNode(root, element);
                break;
            }
        }
示例#5
0
		public AIAgent( int iId )
		{
			m_Root = BehaviourTreeParser.Instance.CreateBehaviourTree( iId );
		}
示例#6
0
 public AIAgent(int iId)
 {
     m_Root = BehaviourTreeParser.Instance.CreateBehaviourTree(iId);
 }