Esempio n. 1
0
        /// <summary>
        /// All actions in game
        /// </summary>
        public void Game()
        {
            Console.CursorVisible = true;
            _game = ExitTheGame.ContinueGame;
            while (_game == ExitTheGame.ContinueGame)
            {
                action = UserAction.GetUserAction();
                switch (action)
                {
                case Action.Left:
                    MoveGameCursore(-1, 0);
                    break;

                case Action.Right:
                    MoveGameCursore(1, 0);
                    break;

                case Action.Top:
                    MoveGameCursore(0, -1);
                    break;

                case Action.Bottom:
                    MoveGameCursore(0, 1);
                    break;

                case Action.Enter:
                    showPeleng = !showPeleng;
                    if (showPeleng)
                    {
                        Console.Clear();
                        _form.DrawField(findFoxes);
                        Console.CursorVisible = false;
                        if (findFoxes[cursorX, cursorY].Equals(NO_ACTION))
                        {
                            _view.ShotsFired(cursorX, cursorY);
                        }
                    }
                    else
                    {
                        Console.Clear();
                        _form.DrawField(findFoxes);
                        MoveGameCursore(0, 0);
                        Console.CursorVisible = true;
                    }
                    break;

                case Action.Exit:
                    Console.WriteLine(_strExit);
                    if (GameExit() == false)
                    {
                        _game = ExitTheGame.MenuGame;
                    }
                    else
                    {
                        Console.Clear();
                        _form.DrawField(findFoxes);
                        showPeleng = false;
                    }
                    break;
                }
            }
            WhatToDoNext();
        }