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;
		}
Esempio n. 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;
			}
		}
Esempio n. 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;
            }
        }
Esempio n. 5
0
		public AIAgent( int iId )
		{
			m_Root = BehaviourTreeParser.Instance.CreateBehaviourTree( iId );
		}
Esempio n. 6
0
 public AIAgent(int iId)
 {
     m_Root = BehaviourTreeParser.Instance.CreateBehaviourTree(iId);
 }