Example #1
0
        public void update(bool validate)
        {
            this.validate = validate;
            if (validate == true)
            {
                currentLevel.actorHandler.update(true);
            }
            mousedata = TCODMouse.getStatus();

            key = TCODConsole.checkForKeypress((int)TCODKeyStatus.KeyPressed);
            debugCommands.update();


            if (gameStatus == GameStatus.LOADING)
            {
                loadingGui.update();
            }
            else if (gameStatus == GameStatus.DEFEAT)
            {
                if (key.Pressed)
                {
                    Console.WriteLine("Restarting game...");
                    initialize(true);
                }
            }
            else if (gameStatus == GameStatus.MENU)
            {
                menuGui.focused = true;
                menuGui.update();

                if (key.KeyCode == (TCODKeyCode.Escape))
                {
                    menuGui.focused = false;
                    gameStatus      = GameStatus.IDLE;
                }
            }
            else
            {
                gameStatus = GameStatus.IDLE;

                player.update();
                gui.update();
                messageGui.update();
                if (gameStatus == GameStatus.NEW_TURN)
                {
                    currentLevel.update();
                    //Message.flush();
                }

                Message.update();
            }
            lastKey = key;
        }