Beispiel #1
0
        public virtual void StartNewState(MAIState newState)
        {
            StateLastTime = Time.time;      //Store the last time the Animal made a transition


            if (currentState != null && currentState != newState)
            {
                currentState.Finish_Tasks(this);                 //Finish all the Task on the Current State
                //   currentState.Finish_Decisions(this);             //Finish all the Decisions on the Current State
            }

            currentState = newState;                            //Set a new State

            ResetVarsOnNewState();

            OnAIStateChanged.Invoke(currentState.ID);
            currentState.Start_AIState(this);                   //Start all Tasks on the new State
            currentState.Prepare_Decisions(this);               //Start all Tasks on the new State
        }