Example #1
0
        static void Main(string[] args)
        {
            Cat c = new Cat("Vladik", new DateTime(2010, 05, 25));

            c.MakeNoise();
            Console.WriteLine($"Кошке по имени {c.Name} уже {c.GetAge()} лет");
            //c.HungryStatus = 150;

            Cat ct = new Cat($"Ваня", new DateTime(2011, 09, 11));

            ct.MakeNoise();
            Console.WriteLine($"Кошке по имени {ct.Name} уже {ct.GetAge()} лет");


            CatSmartHouse catSmartH = new CatSmartHouse(900);

            catSmartH.AddCat(c);
            catSmartH.AddCat(ct);

            Console.SetCursorPosition(0, catSmartH.CatsCount + 1);

            CommandCenter command = new CommandCenter(catSmartH);

            Console.ReadLine();
        }
Example #2
0
        private void WaitCommand(CatSmartHouse catSmartHouse)
        {
            string command = "";

            while (command != "exit")
            {
                Console.SetCursorPosition(0, CatSmartHouse.CatsCount + 2);
                command = Console.ReadLine();
                string[] array = command.Split();
                if (array[0] == "store")
                {
                    int smth = Convert.ToInt32(array[2]);
                    CatSmartHouse.FoodResourse += smth;
                    Console.Write(array[1]);
                }

                if (array[0] == "cls")
                {
                    for (int i = 5; i < 10; i++)
                    {
                        Console.SetCursorPosition(0, i);
                        for (int j = 0; j < 100; j++)
                        {
                            Console.Write(' ');
                        }
                    }
                }
                else if (command == "help")
                {
                    Console.WriteLine("Добавить еды в вольер: store название еды количество еды");
                    Console.WriteLine("Очистить консоль: cls");
                    Console.WriteLine("Изменить границу голода: ChangeHungryLimit +/- на сколько");
                    Console.WriteLine("Выход: exit");
                }
                if (array[0] == "ChangeHungryLimit+++")
                {
                    if (array[1] == "+")
                    {
                        catSmartHouse.hangryLimit -= Convert.ToInt32(array[2]);
                    }
                    else if (array[1] == "-")
                    {
                        catSmartHouse.hangryLimit += Convert.ToInt32(array[2]);
                    }
                }
            }
        }
Example #3
0
 public CommandCenter(CatSmartHouse catSmartHouse)
 {
     CatSmartHouse = catSmartHouse;
     WaitCommand(CatSmartHouse);
 }