Example #1
0
        public override void OnAfterDeserialize(BTAsset btAsset)
        {
            base.OnAfterDeserialize(btAsset);

            for (int i = 0; i < m_children.Count; i++)
            {
                m_children[i].OnAfterDeserialize(btAsset);
            }
        }
Example #2
0
        public override void OnBeforeSerialize(BTAsset btAsset)
        {
            base.OnBeforeSerialize(btAsset);

            if (m_child != null)
            {
                m_child.OnBeforeSerialize(btAsset);
            }
        }
Example #3
0
        public override void OnAfterDeserialize(BTAsset btAsset)
        {
            base.OnAfterDeserialize(btAsset);

            if (m_child != null)
            {
                m_child.OnAfterDeserialize(btAsset);
            }
        }
Example #4
0
        public override void OnBeforeSerialize(BTAsset btAsset)
        {
            base.OnBeforeSerialize(btAsset);

            if (string.IsNullOrEmpty(m_behaviourTreeID))
            {
                m_behaviourTreeID = BTUtils.GenerateUniqueStringID();
            }

            btAsset.SetSubtreeAsset(m_behaviourTreeID, m_behaviourTreeAsset);
        }
Example #5
0
 public virtual void OnBeforeSerialize(BTAsset btAsset)
 {
     foreach (var constraint in m_constraints)
     {
         constraint.OnBeforeSerialize(btAsset);
     }
     foreach (var service in m_services)
     {
         service.OnBeforeSerialize(btAsset);
     }
 }
Example #6
0
        public override void OnAdd()
        {
            base.OnAdd();
            var bt = AssetResources.LoadAssetImmediatly(BtPath) as BTAsset;

            m_behaviourTree = bt;
            m_blackboard    = new Blackboard();
            if (m_behaviourTree != null)
            {
                m_btInstance = m_behaviourTree.CreateRuntimeTree();
            }
            m_timeElapsedSinceLastUpdate = 0.0f;
            m_isRunning = true;
        }
Example #7
0
 public void SetSubtreeAsset(string subtreeID, BTAsset subtreeAsset)
 {
     if (!string.IsNullOrEmpty(subtreeID))
     {
         AssetIDPair subtree = m_subtrees.Find(obj => obj.assetID == subtreeID);
         if (subtree != null)
         {
             subtree.asset = subtreeAsset;
         }
         else
         {
             subtree         = new AssetIDPair();
             subtree.asset   = subtreeAsset;
             subtree.assetID = subtreeID;
             m_subtrees.Add(subtree);
         }
     }
 }
Example #8
0
        public virtual void OnAfterDeserialize(BTAsset btAsset)
        {
            if (m_constraints == null)
            {
                m_constraints = new List <Constraint>();
            }
            if (m_services == null)
            {
                m_services = new List <Service>();
            }

            foreach (var constraint in m_constraints)
            {
                constraint.OnAfterDeserialize(btAsset);
            }
            foreach (var service in m_services)
            {
                service.OnAfterDeserialize(btAsset);
            }
        }
Example #9
0
 public void setBehaviourTree(BTAsset asset)
 {
     m_behaviourTree = asset;
 }
Example #10
0
        public override void OnAfterDeserialize(BTAsset btAsset)
        {
            base.OnAfterDeserialize(btAsset);

            m_behaviourTreeAsset = btAsset.GetSubtreeAsset(m_behaviourTreeID);
        }
Example #11
0
 public virtual void OnAfterDeserialize(BTAsset btAsset)
 {
 }
Example #12
0
 public virtual void OnBeforeSerialize(BTAsset btAsset)
 {
 }