Ejemplo n.º 1
0
        public static void Main(string[] args)
        {
            bool stillPlaying = true;

            Pet        newPet     = new Pet();
            RoboticPet roboticPet = new RoboticPet();
            OrganicPet organicPet = new OrganicPet();
            PetShelter myShelter  = new PetShelter();

            while (stillPlaying)
            {
                myShelter.TickOnAllPets();
                Console.WriteLine("\n\tHello! Welcome to Virtual Pets");
                Console.WriteLine("\n");
                Console.WriteLine("\t1. View list of pets.");
                Console.WriteLine("\t2. Bringing in a new pet?");
                Console.WriteLine("\t3. Select a certain pet to interact with.");
                Console.WriteLine("\t4. Feed your pet(s).");
                Console.WriteLine("\t5. Give your pet(s) water.");
                Console.WriteLine("\t6. Your pet(s) bored, let's play.");
                Console.WriteLine("\t7. Time for a checkup with the vet.");
                Console.WriteLine("\t8. Adopt a pet!\n");
                Console.WriteLine($"\n\tYou are currently interacting with " + newPet.Name);
                Console.WriteLine("\n\t Press 'Q' to Exit game.");
                Console.WriteLine("\tPress enter to return to the Main Menu\n");

                string userChoice = Console.ReadLine().ToLower();
                Console.Clear();


                switch (userChoice)
                {
                case "1":
                    myShelter.PrintAllPetsList();
                    Console.Clear();
                    break;


                case "2":

                    Console.WriteLine("\tEnter 1' [Organic Pet] or '2' [Robotic Pet].");
                    string petChoice = Console.ReadLine();

                    switch (petChoice)
                    {
                    case "1":

                        myShelter.PrintAllPetsList();
                        organicPet = new OrganicPet();
                        organicPet.CreatePet();
                        myShelter.AddPet(organicPet);
                        break;

                    case "2":

                        myShelter.PrintAllPetsList();
                        roboticPet = new RoboticPet();
                        roboticPet.CreatePet();
                        myShelter.AddPet(roboticPet);
                        break;

                    default:
                        break;
                    }
                    break;


                case "3":
                    myShelter.PrintAllPetsList();
                    Console.WriteLine("Select pet by number to view.");
                    newPet = myShelter.FindAnimalByIndex();
                    break;

                case "4":

                    Console.WriteLine("\tEnter 1' [To feed one pet] or '2' [Feed all pets].");
                    string feedChoice = Console.ReadLine();

                    switch (feedChoice)
                    {
                    case "1":

                        newPet.Feed();
                        Console.WriteLine($"\tYou fed {newPet.Name}");
                        break;

                    case "2":

                        myShelter.FeedAll();
                        Console.WriteLine($"\tYou fed all the animals in the shelter!");
                        break;

                    default:
                        break;
                    }
                    break;

                case "5":
                    Console.WriteLine("\tPress '1' [To quench one pet's thirst] or press '2' [For all pets].");

                    string thirstChoice = Console.ReadLine();

                    switch (thirstChoice)
                    {
                    case "1":

                        newPet.GiveWater();
                        Console.WriteLine($"\tYou gave {newPet.Name} somthing to drink");
                        break;

                    case "2":

                        myShelter.WaterAll();
                        Console.WriteLine($"\tYou gave all your animals something to drink.");
                        break;

                    default:
                        break;
                    }
                    break;

                case "6":
                    Console.WriteLine("\tPress '1'[Play with one pet] or press '2' [Play with all pets].");

                    string playChoice = Console.ReadLine();

                    switch (playChoice)
                    {
                    case "1":

                        newPet.Play();
                        Console.WriteLine($"\tYou played with {newPet.Name}");
                        break;

                    case "2":

                        myShelter.PlayWithAll();
                        Console.WriteLine($"\tYou played with all the animals.");
                        break;

                    default:
                        break;
                    }
                    break;

                case "7":
                    Console.WriteLine("\tPress '1' [To take one pet] or press '2' [To take all pets].");

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

                    switch (healthChoice)
                    {
                    case "1":

                        newPet.SeeDoctor();
                        Console.WriteLine($"{ newPet.Name} is feeling much better!");
                        break;

                    case "2":

                        myShelter.SeeDoctorAll();
                        break;

                    default:
                        break;
                    }
                    break;

                case "8":
                    myShelter.PrintAllPetsList();
                    Console.WriteLine("\n\tWho do you want to adopt?");
                    Pet petToRemove = myShelter.FindAnimalByIndex();
                    myShelter.AdoptPet(petToRemove);
                    Console.WriteLine(newPet.Name + $"said yes!! You'll make a great pet parent!");
                    break;

                case "q":

                    Console.ReadLine().ToLower();
                    break;

                default:
                    break;
                }
            }
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            Pet        newPet     = new Pet();
            PetShelter petShelter = new PetShelter();
            RoboticPet roboticPet = new RoboticPet();
            List <Pet> listOfPets = petShelter.GetPetList();

            Console.ForegroundColor = ConsoleColor.DarkGreen;
            Console.WriteLine("Hello! Welcome to Virtual Pets");
            Console.ResetColor();
            newPet.CreatePet();

            petShelter.AddPetToShelter(newPet);


            bool continuePlayingWithPet = true;

            do
            {
                petShelter.AllPetsTick();
                petShelter.ShowAllPetStatus();

                Console.ForegroundColor = ConsoleColor.Cyan;
                Console.WriteLine("\nWhat would you like to do?");
                Console.ResetColor();
                Console.WriteLine($"1. Feed {newPet.GetName()}");
                Console.WriteLine($"2. Play with {newPet.GetName()}");
                Console.WriteLine($"3. Take {newPet.GetName()} to doctor or for maintenance");
                Console.WriteLine("4. Add pet");
                Console.WriteLine("5. Add RoboPet");
                Console.WriteLine("6. Feed all pets");
                Console.WriteLine("7. Take all pets to doctor or for maintenance");
                Console.WriteLine("8. Play with all pets");
                Console.WriteLine("9. Select specific pet");
                Console.WriteLine("10. Adopt pet");
                Console.WriteLine("11. Exit virtual pet");

                string userInput = Console.ReadLine();
                Console.Clear();
                switch (userInput)
                {
                case "1":
                {
                    newPet.Feed();
                    break;
                }

                case "2":
                {
                    newPet.Play();
                    Console.WriteLine("You've played with your Pet");
                    break;
                }

                case "3":
                {
                    newPet.CareForPet();
                    break;
                }

                case "4":
                {
                    newPet = new Pet();
                    newPet.CreatePet();

                    petShelter.AddPetToShelter(newPet);
                    break;
                }

                case "5":
                {
                    roboticPet = new RoboticPet();
                    roboticPet.CreatePet();

                    petShelter.AddPetToShelter(roboticPet);
                    break;
                }

                case "6":
                {
                    petShelter.FeedAllPets();
                    break;
                }

                case "7":
                {
                    petShelter.AllPetsSeeDoctor();
                    break;
                }

                case "8":
                {
                    petShelter.AllPetsPlay();
                    break;
                }

                case "9":
                {
                    petShelter.ShowPetNames();
                    Console.WriteLine("What pet do you want to select?");
                    int selectNewPet = Convert.ToInt32(Console.ReadLine());
                    newPet = petShelter.SelectPetFromShelter(selectNewPet - 1);
                    break;
                }

                case "10":
                {
                    petShelter.ShowPetNames();
                    Console.WriteLine("What pet do you want to adopt?");
                    int selectNewPet = Convert.ToInt32(Console.ReadLine());
                    newPet = petShelter.SelectPetFromShelter(selectNewPet - 1);
                    petShelter.AdoptPetFromShelter(newPet);
                    break;
                }

                case "11":
                {
                    Console.WriteLine("Thanks for playing Virtual Pet");
                    continuePlayingWithPet = false;
                    break;
                }
                }
            } while (continuePlayingWithPet);
        }
Ejemplo n.º 3
0
        static void Main(string[] args)
        {
            //myPet is Object of Type Pet
            Pet        myPet;
            RoboPet    myRoboPet;
            PetShelter roboPetList = new PetShelter();
            PetShelter petList     = new PetShelter();
            double     myMoney     = 40.00;

            Console.WriteLine("Hello! Welcome to Virtual Pet Shelter");
            Console.WriteLine("Earn $200.00 to reach Retierment\n");

            bool keepThinking = true;

            do
            {
                Console.ForegroundColor = ConsoleColor.Cyan;
                if (myMoney < 0)
                {
                    Console.ForegroundColor = ConsoleColor.DarkRed;
                }
                if (myMoney < -50)
                {
                    Console.Clear();
                    Console.WriteLine("Bankrupted!");
                    Console.WriteLine("Game Over: Press Enter to Exit");
                    keepThinking = false;
                }
                if (myMoney >= 200)
                {
                    Console.Clear();
                    Console.ForegroundColor = ConsoleColor.Green;
                    Console.WriteLine("Retirement Achieved");
                    Console.WriteLine("Enjoy your Remaining years! Press Enter to Exit");
                    Console.ResetColor();
                    keepThinking = false;
                }
                Console.WriteLine($"Current Funds: ${myMoney}\n");
                Console.ResetColor();

                petList.PrintAllPetDetails();
                roboPetList.PrintAllRoboPetDetails();

                petList.RemoveDeadPet();
                if (petList.MaxDeadPets())
                {
                    keepThinking = false;
                }

                roboPetList.RemoveTotaledRoboPet();

                Console.WriteLine("Type Number and press Enter:");
                Console.WriteLine("What would you like to do?\n");
                Console.WriteLine("PETS____________________");
                Console.WriteLine("1. Take Animals to Park");
                Console.WriteLine("2. Feed Pets");
                Console.WriteLine("3. Water Pets");
                Console.WriteLine("4. Take a Pet to Vet");
                Console.WriteLine("5. Play With a Pet");
                Console.WriteLine("6. Admit Pet to Shelter");
                Console.WriteLine("7. Adopt Pet");
                Console.WriteLine("ROBOPETS____________________");
                Console.WriteLine("8. Fuel a RoboPet");
                Console.WriteLine("9. Top Off Fluids for a RoboPet");
                Console.WriteLine("10. Run a RoboPet");
                Console.WriteLine("11. Take a RoboPet to the Mechanic");
                Console.WriteLine("12. Build a RoboPet");
                Console.WriteLine("13. Sell a RoboPet");
                Console.WriteLine("14. Exit Game\n");

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

                switch (menuChoice)
                {
                case "1":
                    petList.TakeToPark();
                    myMoney -= 10;
                    break;

                case "2":
                    petList.FeedAllPets();
                    myMoney -= 5;
                    break;

                case "3":
                    petList.WaterAllPets();
                    myMoney -= 5;
                    break;

                case "4":
                    Console.Clear();
                    petList.PrintAllPetNames();
                    Console.Write("Which Pet would you like to take to the Vet: ");
                    int petNumber = Convert.ToInt32(Console.ReadLine());
                    Console.Clear();
                    Pet petToTakeToVet = petList.FindPetNameByIndex(petNumber - 1);
                    petToTakeToVet.SeeDoctor();
                    myMoney -= 5;
                    break;

                case "5":
                    Console.Clear();
                    petList.PrintAllPetNames();
                    Console.Write("Which Pet would you like to paly with: ");
                    petNumber = Convert.ToInt32(Console.ReadLine());
                    Console.Clear();
                    Pet petToPlayWith = petList.FindPetNameByIndex(petNumber - 1);
                    petToPlayWith.Play();
                    break;

                case "6":
                    myPet = new Pet();
                    Console.Clear();
                    Console.Write("Enter Pet's Name: ");
                    myPet.PetName(Console.ReadLine());
                    Console.Write("Enter Pet's Species: ");
                    myPet.PetSpecies(Console.ReadLine());
                    petList.AddPet(myPet);
                    myMoney -= 10;
                    Console.Clear();
                    break;

                case "7":
                    Console.Clear();
                    petList.PrintAllPetNames();
                    Console.Write("Which Pet would you like to Adopt: ");
                    petNumber = Convert.ToInt32(Console.ReadLine());
                    Pet  petToRemove = petList.FindPetNameByIndex(petNumber - 1);
                    bool isAdoptable = petToRemove.CheckIfAdoptable();
                    if (isAdoptable)
                    {
                        petList.RemovePetFromList(petToRemove);
                        myMoney += 40.00;
                        Console.Clear();
                    }
                    else
                    {
                        Console.Clear();
                        Console.ForegroundColor = ConsoleColor.DarkRed;
                        Console.WriteLine("This Pet does NOT meet Adoption Criteria. Health too low!");
                        Console.ResetColor();
                    }
                    break;

                case "8":
                    Console.Clear();
                    roboPetList.PrintAllRoboPetNames();
                    Console.Write("Which RoboPet would you like to Fuel: ");
                    int roboPetNumber = Convert.ToInt32(Console.ReadLine());
                    Console.Clear();
                    RoboPet roboPetToFuel = roboPetList.FindRoboPetNameByIndex(roboPetNumber - 1);
                    roboPetToFuel.FuelUp();
                    myMoney -= 10;
                    break;

                case "9":
                    Console.Clear();
                    roboPetList.PrintAllRoboPetNames();
                    Console.Write("Which RoboPet would you like to Top Off Fluids for: ");
                    roboPetNumber = Convert.ToInt32(Console.ReadLine());
                    Console.Clear();
                    RoboPet roboPetToTopOffFluids = roboPetList.FindRoboPetNameByIndex(roboPetNumber - 1);
                    roboPetToTopOffFluids.TopOffFluids();
                    myMoney -= 5;
                    break;

                case "10":
                    Console.Clear();
                    roboPetList.PrintAllRoboPetNames();
                    Console.Write("Which RoboPet would you like to run: ");
                    roboPetNumber = Convert.ToInt32(Console.ReadLine());
                    Console.Clear();
                    RoboPet roboPetToRun = roboPetList.FindRoboPetNameByIndex(roboPetNumber - 1);
                    roboPetToRun.RunRoboPet();
                    roboPetToRun.RoboTick();
                    break;

                case "11":
                    Console.Clear();
                    roboPetList.PrintAllRoboPetNames();
                    Console.Write("Which RoboPet would you like to take to the Mechanic: ");
                    roboPetNumber = Convert.ToInt32(Console.ReadLine());
                    Console.Clear();
                    RoboPet roboPetToTakeToMechanic = roboPetList.FindRoboPetNameByIndex(roboPetNumber - 1);
                    roboPetToTakeToMechanic.TakeToMechanic();
                    myMoney -= 35;
                    break;

                case "12":
                    myRoboPet = new RoboPet();
                    Console.Clear();
                    Console.Write("Enter RoboPet's Name: ");
                    myRoboPet.PetName(Console.ReadLine());
                    Console.Write("Enter RoboPet's Species: ");
                    myRoboPet.PetSpecies(Console.ReadLine());
                    roboPetList.AddRoboPet(myRoboPet);
                    myMoney -= 20;
                    Console.Clear();
                    break;

                case "13":
                    Console.Clear();
                    roboPetList.PrintAllRoboPetNames();
                    Console.Write("Which RoboPet would you like to Sell: ");
                    roboPetNumber = Convert.ToInt32(Console.ReadLine());
                    RoboPet roboPetToRemove = roboPetList.FindRoboPetNameByIndex(roboPetNumber - 1);
                    bool    isSellable      = roboPetToRemove.CheckIfSellable();
                    if (isSellable)
                    {
                        roboPetList.RemoveRoboPetFromList(roboPetToRemove);
                        myMoney += 60.00;
                        Console.Clear();
                    }
                    else
                    {
                        Console.Clear();
                        Console.ForegroundColor = ConsoleColor.DarkRed;
                        Console.WriteLine("This RoboPet does have high enough RoboHealth to sell!");
                        Console.ResetColor();
                    }
                    break;

                case "14":
                    keepThinking = false;
                    break;

                default:
                    break;
                }
            } while (keepThinking);
        }