コード例 #1
0
        public static void Startup()
        {
            Player      player  = Player.GetPlayer(" ", " ", Player.Classes.Brawler, Player.Body.Athletic, "R1");
            GameObjects options = new GameObjects();
            bool        run     = true;

            do
            {
                Console.WriteLine("Enter new game or load game");
                string input = Console.ReadLine();
                switch (input.ToLower())
                {
                case "skip":
                    run = false;

                    break;

                case "new game":
                    player = NewPlayer();
                    CreateUserOptions(player.Name);
                    options = LoadOptions.InitializeObjects(player);
                    run     = false;
                    break;

                case "load game":
                    options = LoadOptions.LoadObjects(" ");
                    run     = false;
                    break;

                default:
                    Console.WriteLine("\nPlease enter only new game or load game");
                    break;
                }
            }while (run == true);

            StandardMessages.TitleCard();



            Rooms room = MakeRoom(options.Rooms, options.Player.RoomID);

            SearchCommands.ViewRoom(room.Name);

            GeneralCommands.CommandInput(options);
        }
コード例 #2
0
        public static void UserMove(string direction, Player player, List <Rooms> rooms)
        {
            Rooms room = GameOptions.MakeRoom(rooms, player.RoomID);



            string returnID = player.RoomID;

            switch (direction)
            {
            case "n":
                if (room.North == "N/A" && player.RoomID == "R3")
                {
                    Console.WriteLine("\nYou ran into the cash register...too bad it's empty.\n");
                }

                if (room.North == "N/A" && player.RoomID == "R5")
                {
                    Console.WriteLine("\nYou walked into the mayor's desk...\n");
                }



                player.RoomID = room.North;

                break;

            case "s":
                if (room.North == "N/A" && player.RoomID == "R3")
                {
                    Console.WriteLine("\nClean up on Aisle 1...\n");
                }
                if (room.North == "N/A" && player.RoomID == "R4")
                {
                    Console.WriteLine("\nPretty sure that's not chocolate...\n");
                }

                player.RoomID = room.South;
                break;

            case "e":
                if (room.East == "N/A" && player.RoomID == "R1")
                {
                    Console.WriteLine("\nYou walked into your wall...\n");
                }
                if (room.East == "N/A" && player.RoomID == "R4")
                {
                    Console.WriteLine("\nYou're a tough guy but that Alligator is tougher...\n");
                }
                if (room.East == "N/A" && player.RoomID == "R5")
                {
                    Console.WriteLine("\nNothing but trash bin.\n");
                }
                player.RoomID = room.East;
                break;

            case "w":
                if (room.West == "N/A" && player.RoomID == "R2")
                {
                    Console.WriteLine("\nThis is West street territory, even a tough S.O.B like you can't enter a made up territory.\n");
                }
                if (room.West == "N/A" && player.RoomID == "R5")
                {
                    Console.WriteLine("\nNothing but trash bin.\n");
                }

                player.RoomID = room.West;
                break;
            }

            if (player.RoomID == "R6")
            {
                //rooms.RemoveAt(6);
                player.RoomID = "R1";
            }

            if (player.RoomID == "R6")
            {
                player.RoomID = "N/A";
            }


            if (player.RoomID == "N/A")
            {
                Console.WriteLine("There is no exit this way");
                player.RoomID = returnID;
            }



            room = GameOptions.MakeRoom(rooms, player.RoomID);
            SearchCommands.ViewRoom(room.Name);
        }