コード例 #1
0
ファイル: Adventure.cs プロジェクト: RoadRaz/igme206
        public void PlayGame(Adventure adventObj, Controller controlObj, View viewObj, GameLogic logicObj, Rooms roomObj)
        {
            Reset();
            string[] roomDescriptions = roomObj.CopyDescriptionsFromFile();
            if (logicObj.CheckFileExists(roomDescriptions, roomObj))
            {
                viewObj.FileNotFound();
                return;
            }
            int currentRoom = 1; //Starting at Room 1 in the game

            viewObj.StartGameText();
            viewObj.NextStepPrompt();
            //Inner Game Loop
            while (true)
            {
                string userInput = "";
                userInput = controlObj.GetInput();
                int newRoom = logicObj.MakeMove(userInput, currentRoom, adventObj);
                if (newRoom == -1) //Quit game
                {
                    return;
                }
                currentRoom = newRoom;

                //If Room 5 Visited-----------------------------------------------------------
                string gameDecider = logicObj.CheckRoom5Condition(currentRoom, roomDescriptions, adventObj);
                viewObj.GameVerdict(gameDecider);
                if (gameDecider != "")
                {
                    break;
                }
                //----------------------------------------------------------------------------

                logicObj.CheckPickup(currentRoom, adventObj);
                string strRoom = logicObj.FetchDescription(currentRoom, roomDescriptions);
                if (adventObj.sameRoomCondition == true)
                {
                    viewObj.ShowMap();
                    viewObj.SameRoomDisclaimer();
                }
                else
                {
                    viewObj.PrintDescription(strRoom);
                }
                viewObj.NextStepPrompt();
            }
        }
コード例 #2
0
 public void CheckPlayAgain(char playAgainInput, Adventure adventObj, Controller controlObj, View viewObj, GameLogic logicObj, Rooms roomObj)
 {
     if (playAgainInput == 'Y' || playAgainInput == 'y')
     {
         adventObj.PlayGame(adventObj, controlObj, viewObj, logicObj, roomObj);
     }
     if (playAgainInput == 'N' || playAgainInput == 'n')
     {
         adventObj.playGameAgain = false;
     }
 }