Esempio n. 1
0
        public static void CollectInput(Farm farm, IChicken animal)
        {
            Console.Clear();

            for (int i = 0; i < farm.ChickenHouses.Count; i++)
            {
                Console.WriteLine($"{i + 1} Chicken House has ({farm.ChickenHouses[i].animalCount}/{farm.ChickenHouses[i].Capacity})");
                System.Console.WriteLine();
                farm.ChickenHouses[i].GroupedAnimals();
                System.Console.WriteLine();
            }

            Console.WriteLine();

            // How can I output the type of animal chosen here?
            Console.WriteLine($"Place the {animal.Type}(s) where?");

            Console.Write("> ");
            int choice = Int32.Parse(Console.ReadLine()) - 1;


            //Hughes told this first
            farm.ChickenHouses[choice].AddResource(animal);

            /*
             *  Couldn't get this to work. Can you?
             *  Stretch goal. Only if the app is fully functional.
             */
            // farm.PurchaseResource<IGrazing>(animal, choice);
        }
 private void UpdateText(IChicken chicken)
 {
     charText.text  = chicken.GetType().Name;
     classText.text = $"Class\n {chicken.Class}";
     skillText.text = $"Skill\n {chicken.Skill}";
     speedText.text = $"Speed\n {chicken.Movement}";
 }
Esempio n. 3
0
        public static void CollectInput(Farm farm, IChicken animal)
        {
            Utils.Clear();

            for (int i = 0; i < farm.ChickenHouse.Count; i++)
            {
                Console.WriteLine($"{i + 1}. Chicken House");
            }

            Console.WriteLine();

            // How can I output the type of animal chosen here?
            Console.WriteLine($"Place the animal where?");

            Console.Write("> ");
            int choice = Int32.Parse(Console.ReadLine());

            farm.ChickenHouse[choice - 1].AddResource(animal);

            /*
             *  Couldn't get this to work. Can you?
             *  Stretch goal. Only if the app is fully functional.
             */
            // farm.PurchaseResource<IGrazing>(animal, choice);
        }
Esempio n. 4
0
        public static void CollectInput(Farm farm, IChicken chicken)
        {
            Console.Clear();

            if (farm.ChickenHouses.Count == 0)
            {
                Console.WriteLine("No chicken houses available. Buy a chicken house! Press any key to continue");
                Console.Write("> ");
                Console.ReadLine();
            }
            else
            {
                for (int i = 0; i < farm.ChickenHouses.Count; i++)
                {
                    Console.WriteLine($"{i + 1}. Chicken House (contains {farm.ChickenHouses[i].AnimalCount()} chickens)");
                }
                Console.WriteLine();

                // How can I output the type of animal chosen here?
                Console.WriteLine($"Place the chicken where?");

                Console.Write("> ");
                int choice = 0;
                while (!int.TryParse(Console.ReadLine(), out choice))
                {
                    Console.WriteLine("That was invalid. Enter a valid selection.");
                }
                // int choice = Int32.Parse(Console.ReadLine()) - 1;


                if (choice > farm.ChickenHouses.Count)
                {
                    Console.WriteLine("Incorrect Selection. Press any key to continue");
                    Console.Write("> ");
                    Console.ReadLine();
                }
                else
                {
                    if (farm.ChickenHouses[choice - 1].Capacity == farm.ChickenHouses[choice - 1].AnimalCount())
                    {
                        Console.WriteLine("Too many animals. Press any key to continue");
                        Console.Write("> ");
                        Console.ReadLine();
                    }
                    else
                    {
                        farm.ChickenHouses[choice - 1].AddResource(chicken);
                        Console.WriteLine($"Your Chicken was placed in the Chicken House ! Press any key to continue");
                        Console.Write("> ");
                        Console.ReadLine();
                    }
                }
            }
        }
Esempio n. 5
0
        public static void CollectInput(Farm farm, IChicken animal)
        {
            Console.Clear();
            List <ChickenHouse> capacityList = farm.ChickenHouses.Where(thingy => thingy.NumberOfAnimals < thingy.Capacity).ToList();

            if (capacityList.Count == 0)
            {
                Console.WriteLine("All Chicken Houses are at capacity or you have not created a Chicken House. Please create a new Chicken House.");
                Console.WriteLine("Please press enter to return to the main menu.");
                Console.ReadLine();
                return;
            }
            else
            {
                for (int i = 0; i < capacityList.Count; i++)
                {
                    if (capacityList[i].NumberOfAnimals < capacityList[i].Capacity)
                    {
                        // if the grazing field is not over capacity, display and chose it
                        // Console.WriteLine($"{i + 1}. Number of animals in grazing field {i + 1}: {capacityList[i].NumberOfAnimals}");
                        Console.WriteLine($"{i + 1}. Number of chickens in chicken house #{i + 1}: {capacityList[i].chickenCount}");
                        Console.WriteLine("- - - - - - - - - - - - - - - - ");
                    }
                    else
                    {
                        Console.WriteLine("All Chicken Houses are at capacity, please create a new Chicken House.");
                        Console.WriteLine("Please press enter to return to the main menu.");
                        Console.ReadLine();
                        return;
                    }
                }

                Console.WriteLine();

                // How can I output the type of animal chosen here?
                Console.WriteLine($"Place the animal where?");

                Console.Write("> ");
                int choice = Int32.Parse(Console.ReadLine());
                Console.WriteLine("Congrats on buying a new animal!");
                Thread.Sleep(1000);
                capacityList[choice - 1].AddResource(animal);

                /*
                 *  Couldn't get this to work. Can you?
                 *  Stretch goal. Only if the app is fully functional.
                 */
                // farm.PurchaseResource<IGrazing>(animal, choice);
            }
        }
        public static void CollectInput(Farm farm, IChicken animal)
        {
            Console.Clear();

            List <ChickenHouse> CapacityList = farm.ChickenHouses.Where(thing => thing.GetCount < thing.Capacity).ToList();

            if (CapacityList.Count == 0)
            {
                Console.WriteLine(" All Fields are at Capacity");
                Console.WriteLine("Press return key to return to Main Menu");
                Console.ReadLine();
                return;
            }
            else
            {
                for (int i = 0; i < CapacityList.Count; i++)
                {
                    if (CapacityList[i].GetCount < farm.ChickenHouses[i].Capacity)
                    {
                        Console.WriteLine($"Chicken Coop {i + 1}:");
                    }
                    Console.WriteLine($"Chicken Coop ({CapacityList[i].Animals.Count} Total Chickens - {CapacityList[i].Chicken()} chicken)");
                }
            }

            Console.WriteLine();

            // How can I output the type of animal chosen here?
            Console.WriteLine($"Place the animal where?");

            Console.Write("> ");
            int choice = Int32.Parse(Console.ReadLine());

            CapacityList[choice - 1].AddResource(animal);

            /*
             *  Couldn't get this to work. Can you?
             *  Stretch goal. Only if the app is fully functional.
             */
            // farm.PurchaseResource<IGrazing>(animal, choice);
        }
Esempio n. 7
0
        public static void CollectInput(Farm farm, IChicken animal)
        {
            Utils.Clear();
            List <ChickenHouse> maxChickenList = farm.ChickenHouses.Where(house => house.Capacity < house.MaxCapacity).ToList();

            for (int i = 0; i < maxChickenList.Count; i++)
            {
                Console.WriteLine($"{i + 1}. Chicken House {maxChickenList[i].Capacity}");
            }

            Console.WriteLine();

            // How can I output the type of animal chosen here?
            Console.WriteLine($"Place the animal where?");
            Console.WriteLine();

            Console.Write("> ");
            int choice = Int32.Parse(Console.ReadLine());

            choice--;
            ChosenFacility(choice, animal, maxChickenList);
        }
        public static void CollectInput(Farm farm, IChicken chicken)
        {
            Utils.Clear();

            for (int i = 0; i < farm.ChickenHouses.Count; i++)
            {
                if (farm.ChickenHouses[i].chickenCount != farm.ChickenHouses[i].Capacity)
                {
                    Console.WriteLine($"{i + 1}. {farm.ChickenHouses[i].ToString()} Max Capacity: {farm.ChickenHouses[i].Capacity}");
                }
            }

            //
            Console.WriteLine();
            // How can I output the type of chicken chosen here?

            Console.WriteLine($"Place the chicken where?");
            Console.Write("> ");
            int choice = Int32.Parse(Console.ReadLine()) - 1;

            if (choice < farm.ChickenHouses.Count)
            {
                farm.ChickenHouses[choice].AddResource(chicken);
            }
            else
            {
                Console.WriteLine("Not a valid facility. You may need to create one!");
                Console.ReadLine();
            }

            /*
             *  Couldn't get this to work. Can you?
             *  Stretch goal. Only if the app is fully functional.
             */
            // farm.PurchaseResource<IGrazing>(chicken, choice);
        }
Esempio n. 9
0
 public Duck()
 {
     Chicken = new Chicken();
 }
Esempio n. 10
0
 private static void setValues(IChicken chicken, Dictionary <string, object> values)
 {
     chicken.Class    = (string)values["class"];
     chicken.Skill    = (string)values["skill"];
     chicken.Movement = Convert.ToInt32(values["movement"]);
 }
Esempio n. 11
0
 public Egg(IChicken chicken)
 {
     Chicken = chicken;
 }
Esempio n. 12
0
 public static void ChosenFacility(int option, IChicken animal, List <ChickenHouse> availableChickenHouseList)
 {
     availableChickenHouseList[option].AddResource(animal);
 }