Beispiel #1
0
        void ProgObstacle()
        {
            while (true)
            {
                for (int i = 0; i < Omgr.Count; i++)
                {
                    double   distance;
                    Obstacle obstacle = Omgr.At(i);

                    Vect2D vect = GetVectorToTarget(obstacle.pos, 0);
                    rb.SetV(0);
                    TurnAbsAngle(vect.GetPhiGrad(), 5);

                    do
                    {
                        double dPhi = GetRelAngle(vect.GetPhiGrad()) / 10;
                        rb.Set_dPhi(dPhi);
                        rb.SetV(5);

                        WaitForUpdate();

                        distance = vect.VectLength();
                        vect     = GetVectorToTarget(obstacle.pos, 0);
                    }while (vect.VectLength() < distance);
                }

                WaitForUpdate();
            }
        }
Beispiel #2
0
 void OnMouseDown(object sender, MouseEventArgs e)
 {
     if (!createRobotsMenue.Checked)
     {
         label1.Text = RobotMgr.GetInfo(e.Location);
     }
     if (createObstaclesMenu.Checked)
     {
         Omgr.NewObstacle(e.Location);
     }
     else if (createRobotsMenue.Checked)
     {
         RobotMgr.CreateRobot(int.Parse(_prgNumEd.Text), e.Location);
     }
     this.Invalidate();
 }
Beispiel #3
0
 void OnPaint(object sender, PaintEventArgs e)
 {
     RobotMgr.Paint(e.Graphics);
     Omgr.Paint(e.Graphics);
 }