Exemple #1
0
        public void WaitCommands(CatSmartHouse AnotherName)
        {
            string command = "";

            while (command != "exit")
            {
                Console.SetCursorPosition(0, CatSmartHouse.CatsCount + 2);
                command = Console.ReadLine();
                string[] array = command.Split();
                if (array[0] == "store")
                {
                    int namb = Convert.ToInt32(array[2]);
                    CatSmartHouse.FoodResource += namb;
                    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(' ');
                        }
                    }
                }
                if (array[0] == "help")
                {
                    Console.WriteLine("Добавить еды в вальер: store название еды количество ");
                    Console.WriteLine("Очистить консоль: cls");
                    Console.WriteLine("Изменить границу голода: ChangeHungryLimit +/- на сколько");
                    Console.WriteLine("Выход: exit");
                }
                if (array[0] == "ChangeHungryLimit")
                {
                    if (array[1] == "+")
                    {
                        AnotherName.hangrLimit -= Convert.ToInt32(array[2]);
                    }
                    else if (array[1] == "-")
                    {
                        AnotherName.hangrLimit += Convert.ToInt32(array[2]);
                    }
                }
            }
        }
Exemple #2
0
        static void Main(string[] args)
        {
            Cat cat  = new Cat("Анфиса", new DateTime(2015, 10, 11));
            Cat cat1 = new Cat("Маша", new DateTime(1993, 9, 6));

            CatSmartHouse cats = new CatSmartHouse(100);

            {
                cats.AddCat(cat);
                cats.AddCat(cat1);
            }
            //cat.HungryStatus = 150;
            //cat1.HungryStatus = 60;
            Console.SetCursorPosition(0, cats.CatsCount + 1);
            CommandCenter command = new CommandCenter(cats);

            Console.ReadLine();
        }
Exemple #3
0
 public CommandCenter(CatSmartHouse AnotherName)
 {
     CatSmartHouse = AnotherName;
     WaitCommands(CatSmartHouse);
 }