public CommandCenter(CatSmartHouse catSmart) { WaitCommands(); }
static void Main(string[] args) { CatSmartHouse cat = new CatSmartHouse(300); Cat Barsik = new Cat("Барсик", new DateTime(2015, 7, 20), 100); cat.AddCat(Barsik); Barsik.GetStatus(); Cat Matroskin = new Cat("Матроскин", new DateTime(2012, 8, 23), 100); cat.AddCat(Matroskin); Matroskin.GetStatus(); Console.SetCursorPosition(1, 2 + 1); Console.ReadLine(); }
static void Main(string[] args) { Cat bochka = new Cat(" Mephedrone ", new DateTime(1999, 10, 1)); Cat vladik = new Cat(" Heroin ", new DateTime(1998, 11, 02)); vladik.Makenois(); vladik.HungryStatus = 150; Console.WriteLine($"Кошке по имени{vladik.Name} уже {vladik.GatAge()} лет"); Console.SetCursorPosition(0, 3 + 1); Console.ReadLine(); CatSmartHouse catSmartH = new CatSmartHouse(900); catSmartH.AddCat(vladik); catSmartH.AddCat(bochka); }
public void WaitCommand(Cat cat, CatSmartHouse CatHouse) { string command = ""; while (command != "exit") { Console.SetCursorPosition(0, CatHouse.CatsCount + 1); command = Console.ReadLine(); string[] array = command.Split(); if (array[0] == "store") { int smth = Convert.ToInt32(array[2]); CatHouse.FoodResourse += smth; } if (command == "cls") { for (int i = 0; i < 1000; i++) { Console.Clear(); Console.Write(i); } } else if (command == "help") { Console.WriteLine("Списки доступных вам команд: \n"); Console.ForegroundColor = ConsoleColor.Blue; Console.WriteLine("Добавить корма в вольер: store *название корма* *количество корма*"); Console.WriteLine("Очистить консоль: cls"); Console.WriteLine("Изменить границу голода: ChangeHungryLimit *на сколько*"); Console.ResetColor(); } if (command == "ChangeHungryLimit") { if (array[1] == "+") { int.TryParse(Console.ReadLine(), out eat); eat -= Convert.ToInt32(array[2]); } else if (array[1] == "-") { int.TryParse(Console.ReadLine(), out eat); eat += Convert.ToInt32(array[2]); } } } }
static void Main(string[] args) { Cat cat = new Cat("Рамис", new DateTime(2007, 6, 20)); // cat.MakeNoise(); Console.WriteLine($"Коту по имени {cat.Name} уже {cat.GetAge()} лет"); Cat cat2 = new Cat("Михалыч", new DateTime(2015, 6, 1)); // cat2.MakeNoise(); Console.WriteLine($"Коту по имени {cat2.Name} уже {cat2.GetAge()} лет"); CatSmartHouse catHouse = new CatSmartHouse(900); catHouse.AddCat(cat); catHouse.AddCat(cat2); Console.SetCursorPosition(0, catHouse.CatsCount + 1); // Console.ReadLine(); CommandCenter CC = new CommandCenter(); }
public void WaitCommands() { string command = null; string exit = null; if (command == exit) { CatSmartHouse SmartHouse = new CatSmartHouse(); Console.SetCursorPosition(0, 3 + 1); command = Console.ReadLine(); string[] array = command.Split(); if (array[0] == "exit") { SmartHouse.FoodResource += Int32.Parse(array[2]); Console.Write(array[1]); } } command = Console.ReadLine(); switch (command) { case "Clear": Console.SetCursorPosition(5, 10); Console.Clear(); break; case "help": Console.WriteLine("Clear", "help", "ChangeHungryLimit"); break; case "ChangeHungryLimit": HungryLimit(); break; } }
public CommandCenter(CatSmartHouse CatHouse) { CatSmartHouse = CatHouse; WaitCommand(); }