예제 #1
0
        /// <summary>
        /// update the state machine
        /// </summary>
        /// <param name="gameTime">the current game time</param>
        public void Update(GameTime gameTime)
        {
            // if there's no current state running, and we've somehow tried to update the state machine, throw an exception
            if (currentState == null)
            {
                throw new NullReferenceException("no start state");
            }

            // if we havent started yet, start!
            if (started == false)
            {
                currentState.execEnter();
                started = true;
            }

            //System.Diagnostics.Debug.WriteLine("current state: " + currentState.Name);

            // update the current state
            currentState.execUpdate(gameTime);
        }