Ejemplo n.º 1
0
        private void ReadSensor()
        {
            bool detected = Sensor.ObstacleDetected();

            textBox.Text += Sensor.ObstacleDetected().ToString() + "\n";
            if (detected)
            {
                RobotMap.Update(CurrentPosition, Sensor.GetMainPosition());
                List <Position> sensorPositions = Sensor.GetSensorPositions();
                foreach (Position position in sensorPositions)
                {
                    numberControls[position.Y, position.X].Text = RobotMap.Map[position.Y, position.X].ToString();
                }
            }
        }
Ejemplo n.º 2
0
 private Robot(Canvas canvas, Button startButton, int tileSize, Map map, Rectangle[,] mapControls, TextBlock[,] numberControls, TextBox textBox)
 {
     this.canvas         = canvas;
     this.tileSize       = tileSize;
     this.startButton    = startButton;
     this.mapControls    = mapControls;
     this.numberControls = numberControls;
     this.textBox        = textBox;
     CreateControl();
     Started    = false;
     Running    = false;
     animations = new List <Storyboard>();
     Sensor     = new Sensor(this, map);
     Map        = map;
     RobotMap   = new RobotMap(map.Width, map.Height);
 }