StateStarted() 보호된 메소드

Invoked when the state is first started (added to the stack), but before any instances of GameLoopTick are called.
protected StateStarted ( ) : void
리턴 void
예제 #1
0
        /// <summary>
        /// Pushes a state onto the specified stack.
        /// </summary>
        /// <param name="stackName">The stack on which to place the state.</param>
        /// <param name="newState">The state to add to the specified stack.</param>
        public void PushState(String stackName, AbstractState newState)
        {
            String s = stackName.ToLower();

            if (stackDictionary.ContainsKey(s) == false)
            {
                throw new ArgumentException("Stack '" + s + "' does not exist in the state machine.");
            }

            if (s != "main" || this.stackDictionary["main"].Count > 0)
            {
                newState.Parent = this.stackDictionary[s].Peek();
                newState.Parent.StatePaused();
            }

            this.stackDictionary[s].Push(newState);
            newState.StateMachine = this;
            newState.StateStarted();
        }
예제 #2
0
        /// <summary>
        /// Pushes a state onto the specified stack.
        /// </summary>
        /// <param name="stackName">The stack on which to place the state.</param>
        /// <param name="newState">The state to add to the specified stack.</param>
        public void PushState(String stackName, AbstractState newState)
        {
            String s = stackName.ToLower();
            if (stackDictionary.ContainsKey(s) == false)
                throw new ArgumentException("Stack '" + s + "' does not exist in the state machine.");

            if (s != "main" || this.stackDictionary["main"].Count > 0)
            {
                newState.Parent = this.stackDictionary[s].Peek();
                newState.Parent.StatePaused();
            }

            this.stackDictionary[s].Push(newState);
            newState.StateMachine = this;
            newState.StateStarted();
        }