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();
                }
            }
        }
 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);
 }