Ejemplo n.º 1
0
        private void Start()
        {
            m_blackboard = gameObject.GetComponent <Blackboard>();

            if (m_behaviourTree != null)
            {
                m_btInstance = m_behaviourTree.CreateRuntimeTree();
            }

            m_timeElapsedSinceLastUpdate = 0.0f;
            m_isRunning = true;

            if (m_btInstance != null)
            {
                m_btInstance.Root.OnStart(this);
            }
        }
Ejemplo n.º 2
0
 public override void OnStart(AIAgent agent)
 {
     if (m_behaviourTreeAsset != null)
     {
         m_behaviourTree = m_behaviourTreeAsset.CreateRuntimeTree();
         if (m_behaviourTree != null)
         {
             m_behaviourTree.Root.OnStart(agent);
         }
     }
 }
Ejemplo n.º 3
0
        private void Awake()
        {
            m_blackboard = gameObject.GetComponent <Blackboard>();

            if (m_behaviourTree != null)
            {
                // 根据配置文件初始化出行为树
                m_btInstance = m_behaviourTree.CreateRuntimeTree();
            }

            m_timeElapsedSinceLastUpdate = 0.0f;
            m_isRunning = true;
        }
Ejemplo n.º 4
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;
        }