コード例 #1
0
        } // ends the Update() function

        /// <summary>
        /// This function handles the switching of states.
        /// </summary>
        /// <param name="newState"> The state that the boss will be switching to. </param>
        private void SwitchToState(BossState newState)
        {
            if (newState != null)
            {
                if(currentState != null) currentState.OnEnd(this);
                currentState = newState;
                currentState.OnStart(this);
            } // ends the if statement
        } // ends the SwitchToState() function
コード例 #2
0
 private void SwitchToState(BossState newState)
 {
     if (newState != null)
     {
         if (currentState != null)
         {
             currentState.OnEnd(this);
         }
         currentState = newState;
         currentState.OnStart(this);
     }
 }