Exemplo n.º 1
0
        static void Main(string[] args)
        {
            Pet     myPet     = new Pet();
            Shelter myShelter = new Shelter();
            Organic myOrganic = new Organic();
            Robot   myRobot   = new Robot();


            Console.WriteLine("Hello! Welcome to Virtual Pet Shelter");


            bool keepPlaying = true;

            while (keepPlaying)
            {
                Console.WriteLine("1. Create Robot Pet");
                Console.WriteLine("2. Create Organic Pet");
                Console.WriteLine("3. Check On All Pets");
                Console.WriteLine("4. Feed or Oil All Pets");
                Console.WriteLine("5. Select a Pet to Feed or Oil.");
                Console.WriteLine("6. Play with All Pets");
                Console.WriteLine("7. Select a Pet to Play with.");
                Console.WriteLine("8. Take All Pets to the Vet or Mechanic");
                Console.WriteLine("9. Select a Pet to take to the Vet or Mechanic.");
                Console.WriteLine("10. Select a Pet to be Adopted from the Shelter.");
                Console.WriteLine("11. Exit Game");

                string menuChoice = Console.ReadLine();



                int petBoredom       = myPet.GetBoredom();
                int petHealth        = myPet.GetHealth();
                int petHunger        = myPet.GetHunger();
                int robotPerformance = myRobot.GetPerformance();
                int robotOil         = myRobot.GetOil();


                switch (menuChoice)
                {
                case "1":
                    myShelter.AddPet(myRobot);

                    Console.WriteLine("What Species is Your Robot Pet? ");
                    myRobot.SetSpecies(Console.ReadLine());

                    Console.WriteLine("Please Enter the Name of Your Robot " + myRobot.Species + ": ");
                    myRobot.SetName(Console.ReadLine());
                    break;

                case "2":
                    myShelter.AddPet(myOrganic);

                    Console.WriteLine("What Species is Your Organic Pet? ");
                    myOrganic.SetSpecies(Console.ReadLine());

                    Console.WriteLine("Please Enter the Name of Your Organic " + myOrganic.Species + ": ");
                    myOrganic.SetName(Console.ReadLine());
                    break;

                case "3":
                    foreach (Pet pet in myShelter.ListofPets)
                    {
                        Console.WriteLine("The Current Boredom level of " + pet.Name + " is " + petBoredom);

                        if (pet == myOrganic)
                        {
                            Console.WriteLine("The Current Health Level of " + pet.Name + " is " + petHealth);
                            Console.WriteLine("The Current Hunger Level of " + pet.Name + " is " + petHunger);
                        }
                        else if (pet == myRobot)
                        {
                            Console.WriteLine("The Current Oil Level of " + pet.Name + " is " + robotOil);
                            Console.WriteLine("The Current Performance Level of " + pet.Name + " is " + robotPerformance);
                        }
                    }
                    break;

                case "4":
                    foreach (Pet pet in myShelter.ListofPets)
                    {
                        if (pet == myOrganic)
                        {
                            myPet.Feed();
                            Console.WriteLine("You Fed " + pet.Name);
                        }
                        else if (pet == myRobot)
                        {
                            myRobot.GetOil();
                            Console.WriteLine("You gave oil to " + pet.Name);
                        }
                    }
                    break;

                case "5":
                    myPet = myShelter.SelectPet();
                    if (myPet == myOrganic)
                    {
                        myPet.Feed();
                        Console.WriteLine("You Fed " + myPet.Name);
                    }
                    else if (myPet == myRobot)
                    {
                        myRobot.GetOil();
                        Console.WriteLine("You gave oil to " + myPet.Name);
                    }
                    break;

                case "6":
                    foreach (Pet pet in myShelter.ListofPets)
                    {
                        pet.Play();
                        Console.WriteLine("You played with " + pet.Name);
                    }
                    break;

                case "7":
                    myPet = myShelter.SelectPet();
                    myPet.Play();
                    Console.WriteLine("You played with " + myPet.Name);
                    break;

                case "8":
                    foreach (Pet pet in myShelter.ListofPets)
                    {
                        if (pet == myOrganic)
                        {
                            pet.SeeDoctor();
                            Console.WriteLine("You took " + pet.Name + " to the vet!");
                        }
                        else if (pet == myRobot)
                        {
                            myRobot.SeeMechanic();
                            Console.WriteLine("You took " + pet.Name + " to the mechanic!");
                        }
                    }
                    break;

                case "9":
                    myPet = myShelter.SelectPet();
                    if (myPet == myOrganic)
                    {
                        myPet.SeeDoctor();
                        Console.WriteLine("You took " + myPet.Name + " to the vet!");
                    }
                    else if (myPet == myRobot)
                    {
                        myRobot.SeeMechanic();
                        Console.WriteLine("You took " + myPet.Name + " to the mechanic!");
                    }
                    break;

                case "10":
                    myShelter.AdoptPet();
                    Console.WriteLine("That pet has been adopted!");
                    break;

                case "11":
                    Console.WriteLine("Thank's for Playing!");
                    keepPlaying = false;
                    break;

                default:
                    Console.WriteLine("Invalid Entry");
                    break;
                }

                myPet.Tick();

                Console.WriteLine("Press Any Key to Continue");
                Console.ReadKey();
                Console.Clear();
            }
        }
        static void Main(string[] args)
        {
            Pet Pet = new Pet();

            Console.WriteLine("Hello! Welcome to Virtual Pets.\n");

            Console.WriteLine("What's the name of your new pet?");
            Pet.SetName(Console.ReadLine());
            Console.WriteLine();

            Console.WriteLine("What's the species of your new pet?");
            Pet.SetSpecies(Console.ReadLine());
            Console.WriteLine();

            Console.WriteLine($"\n{Pet.GetName()} the {Pet.GetSpecies()} is here!");

            bool gamePlay = true;

            do
            {
                ;
                Console.WriteLine($"Hunger is {Pet.GetHunger()}.");
                Console.WriteLine($"Boredom is {Pet.GetBoredom()}.");
                Console.WriteLine($"Health is {Pet.GetHealth()}.");
                Pet.Tick();
                Console.WriteLine("\nWhat would you like to do with your pet?\n");

                Console.WriteLine("Play with my pet - press 1");
                Console.WriteLine("\nFeed my pet - press 2");
                Console.WriteLine("\nTake my pet to the doctor - press 3");
                Console.WriteLine("\nQuit - press 4");

                string inPlay = Console.ReadLine();
                Console.Clear();

                switch (inPlay)

                {
                case "1":
                    Pet.Play();
                    break;

                case "2":
                    Pet.Feed();
                    break;

                case "3":
                    Pet.SeeDoctor();
                    break;

                case "4":
                    Console.WriteLine("Thanks for playing!");
                    gamePlay = false;
                    break;

                default:
                    Console.WriteLine("Enter a number.");
                    break;
                }
            } while (gamePlay);
        }
Exemplo n.º 3
0
        static void Main(string[] args)
        {
            Console.WriteLine("Hello! Welcome to Virtual Pets");
            Pet     userPet    = new Pet();
            Shelter myShelter  = new Shelter();
            Organic organicPet = new Organic();
            Robotic roboticPet = new Robotic();

            myShelter.CreateNewPet(userPet, organicPet, roboticPet, myShelter);

            bool playingGame = true;

            while (playingGame)
            {
                Console.Clear();

                foreach (Pet pet in myShelter.ListOfPets)
                {
                    pet.GiveStats();
                }

                userPet = myShelter.SelectPet();
                Console.Clear();
                userPet.GiveStats();
                Console.WriteLine();
                userPet.MenuOptions();

                string menuChoice = Console.ReadLine();

                switch (menuChoice)
                {
                case "1":
                    userPet.Feed();
                    break;

                case "2":
                    userPet.QuenchThirst();
                    break;

                case "3":
                    userPet.Play();
                    break;

                case "4":
                    userPet.SeeDoctor();
                    break;

                case "5":
                    Console.WriteLine($"You did nothing.");
                    break;

                case "6":
                    Console.Clear();
                    myShelter.CreateNewPet(userPet, organicPet, roboticPet, myShelter);
                    break;

                case "7":
                    playingGame = false;
                    Console.WriteLine("Thanks for playing!");
                    break;

                default:
                    Console.WriteLine("Invalid input.");
                    break;
                }

                userPet.Tick();
                userPet.CheckHealth();
                userPet.CheckHunger();
                userPet.CheckThirst();
                userPet.CheckBoredom();
                Console.WriteLine("Press any key to continue.");
                Console.ReadKey();
            }

            Console.ReadLine();
        }
Exemplo n.º 4
0
        static void Main(string[] args)
        {
            //Random object for Tick Method
            Random rand = new Random();

            //Pet Generator
            Console.WriteLine("Say hi to your new xenomorph!");
            Console.WriteLine();
            Console.WriteLine();
            Console.WriteLine("What's your xenomorph's name?");
            string xennyName = Console.ReadLine();


            Pet xenny = new Pet(xennyName, 45.5, 5, "eager");

            //quitFlag - if true, keep going
            bool quitFlag = false;

            //Main Program Logic
            do
            {
                xenny.StatusCheck();
                Console.WriteLine();
                MenuWriter();
                string userInput = Console.ReadLine();

                switch (userInput)
                {
                case "1":
                    xenny.StatusCheck();
                    break;

                case "2":
                    xenny.Bark();
                    break;

                case "3":
                    xenny.PlaysVidya("amped");
                    break;

                case "4":
                    xenny.PowerUp(9001);
                    break;

                case "5":
                    xenny.Feed();
                    break;

                case "6":
                    xenny.Tick(rand.Next(6));
                    break;

                case "7":
                    quitFlag = true;
                    break;

                default:
                    break;
                }
            }while (quitFlag == false);

            Console.WriteLine("Have a great day!");
        }
        static void Main(string[] args)
        {
            Pet myPet = new Pet();

            Console.WriteLine("Hello! Welcome to Virtual Pets\n");

            Console.WriteLine("You have a new Virtual Pet.  What kind of pet is it?");
            myPet.SetSpecies(Console.ReadLine());

            Console.WriteLine("What is your pet's name?");
            myPet.SetName(Console.ReadLine());

            Console.WriteLine($"{myPet.GetName()} the {myPet.GetSpecies()} is ready to play with you!\n\n");
            Console.WriteLine("Press any key to start playing...");
            Console.ReadKey();
            Console.Clear();

            bool playGame = true;

            do
            {
                myPet.Tick();

                Console.WriteLine("\nWhat would you like to do?");
                Console.WriteLine("1. See my pet's status");
                Console.WriteLine("2. Play with my pet.");
                Console.WriteLine("3. Feed my pet.");
                Console.WriteLine("4. Take my pet to the doctor.");
                Console.WriteLine("5. Quit");

                string gameAction = Console.ReadLine();
                Console.Clear();

                switch (gameAction)
                {
                case "1":
                    myPet.ShowStatus();
                    break;

                case "2":
                    myPet.Play();
                    break;

                case "3":
                    myPet.Feed();
                    break;

                case "4":
                    myPet.SeeDoctor();
                    break;

                case "5":
                    Console.WriteLine("Your pet will miss you!  Good-bye.");
                    playGame = false;
                    break;

                default:
                    Console.WriteLine("Please enter a valid number.");
                    break;
                }
            } while (playGame);
        }