コード例 #1
0
ファイル: Program.cs プロジェクト: kyranet/map4
        private static void Main()
        {
            var board = new Board(MaxRows, MaxCols, TextMap, MaxItems);

            board.AddItem(2, 0, 10);
            board.AddItem(2, 2, 5);
            var player = new Player();

            board.PrintMap();
            PrintPlayerInfo(board, player);

            var gameOver = false;

            while (!gameOver)
            {
                PrintPlayerPos(player);
                InputController(board, player);
                board.PrintMap();

                if (player.PickItem(board))
                {
                    Console.WriteLine("Player picked an item");
                }
                else if (player.DropItem(board))
                {
                    Console.WriteLine("Player dropped an item");
                }

                PrintPlayerInfo(board, player);
                gameOver = player.GoalReached(board);
            }

            Console.WriteLine("Player reached the goal");
        }