Ejemplo n.º 1
0
        private void CheckKeyboard()
        {
            bool didPlayerAct = false;

            InputCommands command = rootConsole.GetUserCommand();

            if (commandSystem.IsPlayerTurn)
            {
                if (command.ToString() != "None")
                {
                    Debug.Log("KeyInput: '" + command.ToString() + "'");
                }

                switch (command)
                {
                case InputCommands.UpLeft:
                    didPlayerAct = commandSystem.MovePlayer(Direction.UpLeft);
                    break;

                case InputCommands.Up:
                    didPlayerAct = commandSystem.MovePlayer(Direction.Up);
                    break;

                case InputCommands.UpRight:
                    didPlayerAct = commandSystem.MovePlayer(Direction.UpRight);
                    break;

                case InputCommands.Left:
                    didPlayerAct = commandSystem.MovePlayer(Direction.Left);
                    break;

                case InputCommands.Wait:
                    didPlayerAct = true;
                    break;

                case InputCommands.Right:
                    didPlayerAct = commandSystem.MovePlayer(Direction.Right);
                    break;

                case InputCommands.DownLeft:
                    didPlayerAct = commandSystem.MovePlayer(Direction.DownLeft);
                    break;

                case InputCommands.Down:
                    didPlayerAct = commandSystem.MovePlayer(Direction.Down);
                    break;

                case InputCommands.DownRight:
                    didPlayerAct = commandSystem.MovePlayer(Direction.DownRight);
                    break;

                case InputCommands.Inventory:
                    UIController.ToggleInventoryVisibility();
                    didPlayerAct = true;
                    break;

                case InputCommands.StairsDown:
                    if (World.CanMoveDownToNextLevel())
                    {
                        MoveMapLevelDown();
                        didPlayerAct = true;
                    }
                    break;

                case InputCommands.CloseGame:
                    rootConsole.CloseApplication();
                    break;

                default:
                    break;
                }

                if (didPlayerAct)
                {
                    renderRequired = true;
                    commandSystem.EndPlayerTurn();
                }
            }
            else
            {
                commandSystem.ActivateMonsters();
                renderRequired = true;
            }
        }
Ejemplo n.º 2
0
        private void CheckKeyboard()
        {
            bool didPlayerAct = false;

            InputCommands command = rootConsole.GetUserCommand();

            if (commandSystem.IsPlayerTurn)
            {
                switch (command)
                {
                case InputCommands.UpLeft:
                    didPlayerAct = commandSystem.MovePlayer(Direction.UpLeft);
                    break;

                case InputCommands.Up:
                    didPlayerAct = commandSystem.MovePlayer(Direction.Up);
                    break;

                case InputCommands.UpRight:
                    didPlayerAct = commandSystem.MovePlayer(Direction.UpRight);
                    break;

                case InputCommands.Left:
                    didPlayerAct = commandSystem.MovePlayer(Direction.Left);
                    break;

                case InputCommands.Right:
                    didPlayerAct = commandSystem.MovePlayer(Direction.Right);
                    break;

                case InputCommands.DownLeft:
                    didPlayerAct = commandSystem.MovePlayer(Direction.DownLeft);
                    break;

                case InputCommands.Down:
                    didPlayerAct = commandSystem.MovePlayer(Direction.Down);
                    break;

                case InputCommands.DownRight:
                    didPlayerAct = commandSystem.MovePlayer(Direction.DownRight);
                    break;

                case InputCommands.StairsDown:
                    if (World.CanMoveDownToNextLevel())
                    {
                        MoveMapLevelDown();
                        didPlayerAct = true;
                    }
                    break;

                case InputCommands.CloseGame:
                    rootConsole.CloseApplication();
                    break;

                default:
                    break;
                }

                if (didPlayerAct)
                {
                    renderRequired = true;
                    commandSystem.EndPlayerTurn();
                }
            }
            else
            {
                commandSystem.ActivateMonsters();
                renderRequired = true;
            }
        }