public void DrawReadMap() { if (!drawMapOrNot) //第一次畫時直接畫 { MessageText.text = ""; DrawObstacle.DrawObstacles(); DrawRobot.DrawRobots(); drawMapOrNot = true; } else //第二次以後, 先刪掉原本儲存的資料再畫 { DrawObstacle.obstacles.Clear(); DrawRobot.robots.Clear(); GameObject[] old_obj; old_obj = GameObject.FindGameObjectsWithTag("Motion_Planning"); for (int i = 0; i < old_obj.Length; i++) { Destroy(old_obj [i]); } DrawObstacle.DrawObstacles(); DrawRobot.DrawRobots(); } ProcessText.text = "DrawPotentialField -> BFS -> ShowPath"; }
private void robotViewPanel_Paint(object sender, PaintEventArgs e) { Graphics g = e.Graphics; g.SmoothingMode = SmoothingMode.AntiAlias; DrawRobot dr = new DrawRobot(this.robotViewPanel); dr.thetaX = thetaX; dr.thetaY = thetaY; dr.thetaZ = thetaZ; dr.DrawRobotView(g); g.DrawString(String.Format("{0:f2}", gTotal), fontB, Brushes.Red, 20f, 20f); g.DrawString(String.Format("{0:f2} {1:f2} {2:f2}", thetaX, thetaY, thetaZ), font, Brushes.Red, 20f, 40f); }
private void robotViewPanel_Paint(object sender, PaintEventArgs e) { Graphics g = e.Graphics; g.SmoothingMode = SmoothingMode.AntiAlias; DrawRobot dr = new DrawRobot(this.robotViewPanel); dr.thetaX = thetaX; dr.thetaY = thetaY; dr.thetaZ = thetaZ; dr.DrawRobotView(g); g.DrawString(String.Format("{0:f2}",gTotal), fontB, Brushes.Red, 20f, 20f); g.DrawString(String.Format("{0:f2} {1:f2} {2:f2}", thetaX, thetaY, thetaZ), font, Brushes.Red, 20f, 40f); }