/// <summary>Define what color to use on the node.</summary> public override Color GetTint() { // Check if there is an active game object with a bt runner. AIGraphRunner runner = Selection.activeGameObject != null? Selection.activeGameObject.GetComponent <AIGraphRunner>() : null; if (runner == null) { return(base.GetTint()); } // Check if it is running. BTNode node = target as BTNode; float? runTime = (float?)runner.GetFromBlackboard("BTRunTime" + node.GetInstanceID()); return(runTime.HasValue && runTime.Value == Time.time ? _runningColor : base.GetTint()); }
/// <summary>Get tint of the target node.</summary> public override Color GetTint() { // Check if there is an active game object. if (Selection.activeGameObject == null) { return(base.GetTint()); } // Try to get active state from FSM runner. AIGraphRunner runner = Selection.activeGameObject.GetComponent <AIGraphRunner>(); if (runner == null || _state == null) { return(base.GetTint()); } // Check if it is running. FSMGraph graph = _state.graph as FSMGraph; FSMStateNode current = runner.GetFromBlackboard("CurrentState" + graph.GetInstanceID()) as FSMStateNode; return(current == _state ? Color.yellow : base.GetTint()); }
void Awake() { _runner = GetComponent <AIGraphRunner>(); }