public void OnAirplaneMove(object obj, EventArgs arg) { airplane obj1 = (airplane)obj; NewRecommendedHight = 7 * obj1.Speed - WatherCorrect; if ((obj1.Speed == 0 && obj1.Hight > 0) || /*(obj1.Speed > 0 && obj1.Hight == 0) ||*/ (obj1.Speed < 0 || obj1.Hight < 0) || (obj1.Speed == 0 && obj1.Hight == 0)) { throw new Exception("Самолет разбился"); } if (CountDispatcherMessag >= 1) { if (((OldRecommendedHight - WatherCorrect) - obj1.Hight) >= 300 && (OldRecommendedHight - obj1.Hight) < 600) { PenaltyPoints += 25; } if (((OldRecommendedHight - WatherCorrect) - obj1.Hight) >= 600 && (OldRecommendedHight - obj1.Hight) <= limitPenaltyPoints) { PenaltyPoints += 50; } if ((OldRecommendedHight - obj1.Hight) > limitPenaltyPoints) { throw new Exception("Самолет разбился,разница рекомендуемой и текущей высоты превысила 1000"); } } if (PenaltyPoints >= limitPenaltyPoints) { throw new Exception("Непригоден к полетам, штрафные очки превысили 1000"); } if (obj1.Speed > limitPenaltyPoints) { Console.WriteLine($"Немедленно снизте скорость, диспетчер {Name}"); PenaltyPoints += 100; return; } if (obj1.Speed >= 50) { Console.WriteLine($"Рекомендуемая высота от {Name} равна = {NewRecommendedHight}"); OldRecommendedHight = NewRecommendedHight; CountDispatcherMessag++; } // Thread.Sleep(3000); }
public flySimulation() { airplane = new airplane(); }