Esempio n. 1
0
        static void Main(string[] args)
        {
            Duck link = new Duck(1, 1);

            link.output();
            link.Action();
            link.Eat();
            //            Console.ReadKey();

            Console.WriteLine("************************************************");

            Ostrich link1 = new Ostrich(101.1, 101.1);

            link1.Display();
            link1.Eat();
            //            Console.ReadKey();

            Console.WriteLine("************************************************");

            Dog link2 = new Dog(3, 3);

            link2.Action();
            link2.Eat();
            link2.Output();

            Console.WriteLine("************************************************");

            Cat link3 = new Cat(3, 3);

            link3.Action();
            link3.Eat();
            link3.Output();

            Console.ReadKey();
        }
Esempio n. 2
0
        static void AddHero(List <string> LineOfCharacters, List <string> GetDataFromEnum, string p)
        {
            if (p == "Grandfather")
            {
                Grandfather grandfather = new Grandfather();
                if (CheckQueue(LineOfCharacters, p))
                {
                    Console.WriteLine(grandfather.Name);
                    grandfather.Action();
                    LineOfCharacters.Add("Grandfather");
                }
                else
                {
                    Console.WriteLine("Дед уже тянет");
                    return;
                }
            }
            else if (p == "Granny")
            {
                if (CheckQueue(LineOfCharacters, p))
                {
                    Granny granny = new Granny();
                    granny.Action();
                    LineOfCharacters.Add("Granny");
                }

                else
                {
                    Console.WriteLine("Бабка уже тянет");
                    return;
                }
            }
            else if (p == "Granddaughet")
            {
                if (CheckQueue(LineOfCharacters, p))
                {
                    Granddaughter granddaughter = new Granddaughter();
                    Console.WriteLine(granddaughter.Name);
                    granddaughter.Action();
                    LineOfCharacters.Add("Granddaughet");
                }
                else
                {
                    Console.WriteLine("Внучка уже тянет");
                    return;
                }
            }
            else if (p == "Dog")
            {
                if (CheckQueue(LineOfCharacters, p))
                {
                    Dog dog = new Dog();
                    dog.Action();
                    LineOfCharacters.Add("Dog");
                }
                else
                {
                    Console.WriteLine("Жучка уже тянет");
                    return;
                }
            }
            else if (p == "Cat")
            {
                if (CheckQueue(LineOfCharacters, p))
                {
                    Cat cat = new Cat();
                    cat.Action();
                    LineOfCharacters.Add("Cat");
                }
                else
                {
                    Console.WriteLine("Кошка уже тянет");
                    return;
                }
            }
            else if (p == "Mouse")
            {
                if (CheckQueue(LineOfCharacters, p))
                {
                    Mouse mouse = new Mouse();
                    mouse.Action();
                    LineOfCharacters.Add("Mouse");
                }
                else
                {
                    Console.WriteLine("Мышка уже тянет");
                    return;
                }
            }
            else
            {
                Console.WriteLine("Точно не поможет");
                return;
            }
        }