Exemplo n.º 1
0
        protected object _StopCurrentMode()
        {
            //  pop the current state from the stack and call it's end()
            // returns the result from end()
            // NOTE: nothing is currently done with the return val from end()
            object    retVal  = null;
            IGameMode oldMode = CurrentMode();

            if (oldMode != null)
            {
                retVal = oldMode.End();                 // should still be on the stack (for potential GetCurrentState() during pop) TODO: Is this true?
                _modeDataStack.Pop();
            }
            return(retVal);
        }
Exemplo n.º 2
0
    public void SwitchGameMode(string name)
    {
        if (!modes.ContainsKey(name))
        {
            return;
        }


        if (currentMode != null)
        {
            currentMode.End();
        }

        currentMode = modes[name];

        currentMode.Start();
    }