Example #1
0
        private void LoadBehaviorTreeInfo()
        {
            string    xmlStr = AssetLoader.GetText(behaviorTreeInfoBundlePath, behaviorTreeInfoName).text;
            XDocument xDoc   = XDocument.Parse(xmlStr);

            string rootBehaviorName = xDoc.Root.Name.LocalName;

            rootBehavior      = BaseBehaviorNode.Getbehavior(rootBehaviorName);
            rootBehavior.root = this;
            LoadBehaviorList(xDoc.Root, rootBehavior);
        }
Example #2
0
        private void LoadBehaviorTreeInfo()
        {
            string    xmlStr = ResourcesLoaderHelper.Instance.LoadTextAsset(behaviorTreeInfoPath).text;
            XDocument xDoc   = XDocument.Parse(xmlStr);

            string rootBehaviorName = xDoc.Root.Name.LocalName;

            rootBehavior      = BaseBehaviorNode.Getbehavior(rootBehaviorName);
            rootBehavior.root = this;
            LoadBehaviorList(xDoc.Root, rootBehavior);
        }
Example #3
0
        private void LoadBehaviorList(XElement parentEl, BaseBehaviorNode parentBehavior)
        {
            if (!parentEl.HasElements)
            {
                return;
            }

            BaseBehaviorNode childBehavior;

            foreach (XElement el in parentEl.Elements())
            {
                childBehavior = BaseBehaviorNode.Getbehavior(el.Name.LocalName);
                parentBehavior.AddChild(childBehavior);

                if (el.HasElements)
                {
                    LoadBehaviorList(el, childBehavior);
                }
            }
        }