예제 #1
0
        public void Pigeon()
        {
            Console.Clear();
            //Setting UI color
            Console.ForegroundColor = ConsoleColor.Cyan;
            Console.WriteLine("==========================");
            Console.WriteLine("You have selected a Pigeon");
            Console.WriteLine("==========================");
            Console.ForegroundColor = ConsoleColor.Gray;

            Console.WriteLine("\nWhat would you like to do with the selected animal?");

            Console.WriteLine("1. Train the animal in a new behavior.");
            Console.WriteLine("2. Feed the animal a treat.");
            Console.WriteLine("3. Signal to the animal to perform a behavior.");
            Console.WriteLine("4. listen to the animal make a noise");
            Console.WriteLine("5. Select a different animal.");

            Pigeon p = new Pigeon("signal", "behavior", "pigeon", 4, "corn");

            int choice = Validation.ValidateInt("\nPlease select one: ");

            if (choice < 1 || choice > 5)
            {
                Console.WriteLine("Invalid Entry. Try again!");
                Pigeon();
            }
            else if (choice == 1)
            {
                string b = Validation.ValidateString("\nWhat new behavior are you training the animal to do?");
                string s = Validation.ValidateString("\nWhat signal will you use to ask the animal to perfom this new behavior?");

                p.Signal   = s;
                p.Behavior = b;

                //Behaviors.Add(s, b);

                Console.WriteLine($"The Pigeon learned to {b} when you make the {s}");
                Console.WriteLine("\nPress any key to continue...");
                Console.ReadKey();

                Pigeon();
            }
            else if (choice == 2)
            {
                Console.WriteLine("---------------------");
                Console.WriteLine($"{p.Eat()}");
                Console.WriteLine("---------------------");

                Console.WriteLine("\nPress any key to continue...");
                Console.ReadKey();

                Pigeon();
            }
            else if (choice == 3)
            {
                if (p is ITrainable)
                {
                    Console.WriteLine($"{p.Perform(p.Signal)}");
                    Console.WriteLine("\nPress any key to continue...");
                    Console.ReadKey();

                    Pigeon();
                }
                else
                {
                    Console.WriteLine("The pigeon does not know this signal");
                    Console.WriteLine("\nPress any key to continue...");
                    Console.ReadKey();

                    Pigeon();
                }
            }
            else if (choice == 4)
            {
                Console.WriteLine($"{p.MakeNoise()}");
                Console.WriteLine("\nPress any key to continue...");
                Console.ReadKey();

                Pigeon();
            }
            else if (choice == 5)
            {
                _myMenu       = new Menu("Pigeon (Trainable)", "Dog (Trainable)", "Parrots (Trainable)", "Raccoon", "Bat", "Opossum", "Exit");
                _myMenu.Title = "Welcome to the Zoo";
                _myMenu.Display();
                Selection();
            }
        }
예제 #2
0
        public void Opossum()
        {
            Console.Clear();
            //Setting UI color
            Console.ForegroundColor = ConsoleColor.Cyan;
            Console.WriteLine("==========================");
            Console.WriteLine("You have selected a Opossum");
            Console.WriteLine("==========================");
            Console.ForegroundColor = ConsoleColor.Gray;

            Console.WriteLine("\nWhat would you like to do with the selected animal?");

            Console.WriteLine("1. Train the animal in a new behavior.");
            Console.WriteLine("2. Feed the animal a treat.");
            Console.WriteLine("3. Signal to the animal to perform a behavior.");
            Console.WriteLine("4. listen to the animal make a noise");
            Console.WriteLine("5. Select a different animal.");

            Opossum o = new Opossum("food", 4, "treat");

            int choice = Validation.ValidateInt("\nPlease select one: ");

            if (choice < 1 || choice > 5)
            {
                Console.WriteLine("Invalid Entry. Try again!");
                Opossum();
            }
            else if (choice == 1)
            {
                Console.WriteLine($"The animal you selected is not a trainable animal. Please select a different activity or exit to select a different animal.”");
                Console.WriteLine("\nPress any key to continue...");
                Console.ReadKey();

                Opossum();
            }
            else if (choice == 2)
            {
                Console.WriteLine("---------------------");
                Console.WriteLine($"{o.Eat()}");
                Console.WriteLine("---------------------");

                Console.WriteLine("\nPress any key to continue...");
                Console.ReadKey();

                Opossum();
            }
            else if (choice == 3)
            {
                Console.WriteLine($"The animal you selected is not a trainable animal. Please select a different activity or exit to select a different animal.”");                Console.WriteLine("\nPress any key to continue...");
                Console.ReadKey();

                Opossum();
            }
            else if (choice == 4)
            {
                Console.WriteLine($"{o.MakeNoise()}");
                Console.WriteLine("\nPress any key to continue...");
                Console.ReadKey();

                Opossum();
            }
            else if (choice == 5)
            {
                _myMenu       = new Menu("Pigeon (Trainable)", "Dog (Trainable)", "Parrots (Trainable)", "Raccoon", "Bat", "Opossum", "Exit");
                _myMenu.Title = "Welcome to the Zoo";
                _myMenu.Display();
                Selection();
            }
        }