コード例 #1
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;
            }
        }