Beispiel #1
0
 public static void Stop()
 {
     Car.Clear();
     Deleter.Clear();
     MoveTimer.Stop();
     LightsTimer.Stop();
     GenCarTimer.Stop();
     WorkTimer.Stop();
     CarCount.Text          = "0";
     CurrentlyCarCount.Text = "0";
     WorkTime.Text          = "0 c";
     Cpm.Text = "0";
     WorkTm   = 0;
     UserPanel.ResetBackColor();
     UserPanel.Invalidate();
 }
Beispiel #2
0
 public static void Update()
 {
     CurrentlyCarCount.Text = Cars.Count.ToString();
     foreach (var c in Cars)
     {
         if (Car.Check(c))
         {
             c.Speed = 0;
         }
         else
         {
             c.Speed = Car.CanMove(c);
             if (c.Turn == CTurn.Right)
             {
                 RightTurn.StartTurn(c);
             }
             else if (c.Turn == CTurn.Left)
             {
                 LeftTurn.StartTurn(c);
             }
         }
         Move(c);
         if (c.X < -50 || c.X > UserPanel.Width + 50 || c.Y < -50 || c.Y > UserPanel.Height + 50)
         {
             Deleter.Add(c);
         }
     }
     if (Deleter.Count != 0)
     {
         foreach (var d in Deleter)
         {
             if (d is Car)
             {
                 Cars.Remove((Car)d);
             }
             else if (d is People)
             {
                 Peoples.Remove((People)d);
             }
         }
     }
     UserPanel.Invalidate();
 }