Пример #1
0
        private void PassHour()
        {
            Thread.Sleep(oneHour);
            Thread.Sleep(4000);
            if (hourOfDay == 24)
            {
                Thread.Sleep(1000);
                Printer.Print($".................Statistics per day.................");
                Printer.Print($".................[{ customerSatisfaction }] Customer satisfaction.................");
                Printer.Print($".................[{ shitTakenInDay.Count }] Shits removed by employees.................");
                Printer.Print($".................[{ shitTakenInDay.FindAll(i => i.ShitOwner is Elephant).Count }] Shits taken by Elephants.................");
                Printer.Print($".................[{ shitTakenInDay.FindAll(i => i.ShitOwner is Giraffe).Count }] Shits taken by Giraffes.................");
                Printer.Print($".................[{ shitTakenInDay.FindAll(i => i.ShitOwner is Fox).Count }] Shits taken by Foxes.................");
                Printer.Print($".................[{ shitTakenInDay.FindAll(i => i.ShitOwner is Wolf).Count }] Shits taken by Wolves.................");
                Printer.Print($".................[{ shitTakenInDay.FindAll(i => i.ShitOwner is Rabbit).Count }] Shits taken by Rabbits.................");
                Thread.Sleep(5000);

                hourOfDay            = 0;
                customerSatisfaction = 100;
                shitTakenInDay       = new List <AnimalShit>();
            }
            else
            {
                hourOfDay++;
            }

            lock (HobedShit)
            {
                Printer.Print($".......................One hour has passed the time is now {hourOfDay}:00. Hobed Shit is at {HobedShit.Count}.......................");
                if (HobedShit.Count > 0)
                {
                    foreach (AnimalShit shit in HobedShit)
                    {
                        switch (shit.ShitPriority)
                        {
                        case Priority.Highest:
                            customerSatisfaction -= 4;
                            break;

                        case Priority.High:
                            customerSatisfaction -= 3;
                            break;

                        case Priority.Medium:
                            customerSatisfaction -= 2;
                            break;

                        case Priority.Low:
                            customerSatisfaction -= 1;
                            break;

                        default:
                            break;
                        }
                    }
                }
                if (hourOfDay > 10 && hourOfDay < 20)
                {
                    Printer.Print($"........................................Customer satisfaction at {customerSatisfaction}%............................................");
                }
            }


            Thread.Sleep(4000);
        }