Exemplo n.º 1
0
        public Status Tick()
        {
            Profiler.BeginSample(gameObject.name);

            Status status = m_treeRoot.Tick();

#if DEBUG
            if (status == Status.Error)
            {
                BehaviorTreeDebug.LogError(this, $"[BehaviorTreeAgent] Behavior tree at {gameObject.name} finished a tick with an error");
            }
#endif

            Profiler.EndSample();

            return(status);
        }
Exemplo n.º 2
0
        private void Awake()
        {
#if DEBUG
            if (m_SerializedBehaviorTree == null)
            {
                BehaviorTreeDebug.LogError(this, "Serialized behavior tree is null");
                return;
            }

            if (m_BlackboardContainer == null)
            {
                BehaviorTreeDebug.LogError(this, "Blackboard container is null");
                return;
            }
#endif

            m_treeRoot = m_SerializedBehaviorTree.CreateTree(m_BlackboardContainer.blackboard);
            m_treeRoot.Initialize();
        }