protected override void Initialize() { base.Initialize(); IconColor = Color.Yellow; WheelRadius = Size / 8; Rotmax = Size / 10; Viewing = 300; ViewingResolution = 100; Sonar = new Sensor.Sonar(ViewingResolution, Viewing, Angle, X, Y); }
public static void GetEmptyLocation(ref PointF loc, double size) { Sensor.Sonar sonar = new Sensor.Sonar(360, 360); Point tmp = new Point(); bool check = false; while (!check) { check = true; tmp.X = (int)(Size.Width * random.NextDouble()); tmp.Y = (int)(Size.Height * random.NextDouble()); sonar.Update(tmp); foreach (var item in sonar.Distance) { if (item.Distance < size) { check = false; } } } loc.X = tmp.X; loc.Y = tmp.Y; }