예제 #1
0
    public TLR4(LR4.Form1 MainForm)
    {
        Cars                     = new List <Car>();
        CarsStreamTimer          = new Timer();
        CarsStreamTimer.Interval = 1;
        CarsStreamCounter        = 0;

        CarsStreamToCreateCars = 0;
        CarsStreamTimer.Tick  += new System.EventHandler(CarsStreamTimer_Tick);
        ReadFromGUI(MainForm);

        Generator = new Random(unchecked ((int)(DateTime.Now.Ticks)));

        Rules = new List <Rule>();
    }
예제 #2
0
    public void Step(LR4.Form1 MainForm)
    {
        // Считываем информацию с формы
        ReadFromGUI(MainForm);

        // Проверяем, нужно ли создать новые авто
        if (CarsStreamToCreateCars != 0)
        {
            CreateNewCars((int)MainForm.numericUpDown2.Value, (int)MainForm.numericUpDown3.Value, MainForm.pictureBox1.Height);
        }

        // Здесь изменяем модель


        // Передвигаем машину на дороге
        Act(MainForm.pictureBox1.Width, (int)MainForm.numericUpDown2.Value, (int)MainForm.numericUpDown3.Value);

        MainForm.pictureBox1.Invalidate();

        //Application.DoEvents();
    }
예제 #3
0
 private void ReadFromGUI(LR4.Form1 MainForm)
 {
     CarsStreamIntensity = MainForm.numericUpDown1.Value;
 }