Ejemplo n.º 1
0
        private void PedMove(object obj)
        {
            while (!isClose)
            {
                if (ped1.Y + 50 < Height)
                {
                    if ((!tl1.red || ped1.Y > Height / 2) && (au1.X < Width / 4 || au1.X > Width * 3 / 4) || (help.X > Width / 4 && help.X < Width * 3 / 4 && ped1.Y > Height / 2 && ped1.Y < Height * 5 / 8))
                    {
                        ped1.Move();
                        ped1.On = true;
                    }
                    else
                    {
                        ped1.On = false;
                    }
                }
                else
                {
                    ped1.On = false;
                    ped1    = new Pedestrian(40, Height);
                }
                BeginInvoke(new MyDelegate(Refresh));

                Thread.Sleep(1000);
            }
        }
Ejemplo n.º 2
0
        public MainForm()
        {
            InitializeComponent();

            tl1  = new TrafficLight();
            au1  = new Auto(80, Width);
            ped1 = new Pedestrian(40, Height);
            help = new ES(60, Width);
        }