StateStarted() protected method

Invoked when the state is first started (added to the stack), but before any instances of GameLoopTick are called.
protected StateStarted ( ) : void
return void
Example #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();
        }
Example #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();
        }