Beispiel #1
0
        /// <summary>
        /// Update this state.
        /// </summary>
        /// <param name="aiBehaviour">The connected AIBehaviour.</param>
        internal void StateUpdate(AIBehaviour aiBehaviour)
        {
            activeTimer.SetActive();

            aiBehaviour.Log(this, $"Update");
            OnStateUpdate(aiBehaviour);
            DoSubStates(aiBehaviour, onUpdateOutput.connectedPorts);
        }
Beispiel #2
0
        /// <summary>
        /// Exit this state.
        /// </summary>
        /// <param name="aiBehaviour">The connected AIBehaviour.</param>
        internal void StateExit(AIBehaviour aiBehaviour)
        {
            activeTimer.SetActive();

            aiBehaviour.Log(this, $"Exit");
            OnStateExit(aiBehaviour);
            DoSubStates(aiBehaviour, onExitOutput.connectedPorts);
        }
        /// <summary>
        /// Decide which SubState is the next one.
        /// </summary>
        /// <param name="aiBehaviour">The connected AIBehaviour.</param>
        internal void Decide(AIBehaviour aiBehaviour)
        {
            bool decision = OnDecide(aiBehaviour);

            aiBehaviour.Log(this, $"Decision was: {decision}");

            if (decision)
            {
                Decide(aiBehaviour, outputTrue.connectedPorts);
            }
            else
            {
                Decide(aiBehaviour, outputFalse.connectedPorts);
            }
        }
        /// <summary>
        /// Decides which states is the next one.
        /// </summary>
        /// <param name="aiBehaviour">the connected AIBehaviour.</param>
        /// <returns>Returns the next state.</returns>
        public State Decide(AIBehaviour aiBehaviour)
        {
            bool decision = OnDecide(aiBehaviour);

            aiBehaviour.Log(this, $"Decision was: {decision}");

            if (decision)
            {
                return(Decide(aiBehaviour, outputTrue.connectedPorts));
            }
            else
            {
                return(Decide(aiBehaviour, outputFalse.connectedPorts));
            }
        }
Beispiel #5
0
 /// <summary>
 /// Execute this SubState.
 /// </summary>
 /// <param name="aiBehaviour">The connected AIBehaviour.</param>
 internal void Perform(AIBehaviour aiBehaviour)
 {
     aiBehaviour.Log(this, $"Perform");
     activeTimer.SetActive();
     OnPerform(aiBehaviour);
 }