Exemplo n.º 1
0
        /// <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());
        }
Exemplo n.º 2
0
        /// <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());
        }
Exemplo n.º 3
0
 void Awake()
 {
     _runner = GetComponent <AIGraphRunner>();
 }