protected override void Init(BaseSprite owner) { base.Init(owner); if (null == _behaviorTreeDebug && _owner.SpriteGameObject) { _behaviorTreeDebug = _owner.SpriteGameObject.AddComponent <BehaviorTreeDebug>(); _behaviorTreeDebug.SetEntity(_data, _btEntity); } }
/// <summary> /// Deserializes a whole tree. /// </summary> /// <remarks> /// On first call, it deserializes serialized data and caches it for later usage. /// </remarks> private void Deserialize() { if (m_treeBuilder == null) { BehaviorTreeDebug.Log("Start deserializing a tree builder"); m_treeBuilder = new TreeBuilder(); Deserialize(m_RootNode); BehaviorTreeDebug.Log("Finish deserializing a tree builder"); } }
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); }
public override TreeRoot CreateTree(Blackboard blackboard) { Profiler.BeginSample("SerializedBehaviorTree.CreateTree(Blackboard)"); Profiler.BeginSample(name); Deserialize(); BehaviorTreeDebug.Log($"Start creating a behavior tree {name}"); TreeRoot treeRoot = m_treeBuilder.Build(blackboard); BehaviorTreeDebug.Log($"Finish creating a behavior tree {name}"); Profiler.EndSample(); Profiler.EndSample(); return(treeRoot); }
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(); }
public void OnDestroy() { _runtimeRotateGo.OnDestroy(); BehaviorTreeDebug.RemoveTreeDebugEvent(Reset); }
public void Init() { _runtimeRotateGo = new RunTimeRotateGo(); BehaviorTreeDebug.AddTreeDebugEvent(Reset); }
private void OnEnable() { _treeDebug = target as BehaviorTreeDebug; _treeDebug.OnSelect(true); }