コード例 #1
0
ファイル: Sensors.cs プロジェクト: jorgejavierfm/Wall-E
 public RobotSensors(Map map)
 {
     this.GPS = new GPS(map);
      this.Thermometer = new Thermometer(map);
      this.Ultrasonic = new Ultrasonic(map);
      this.Webcam = new Webcam(map);
      this.Scale = new Scale(map);
 }
コード例 #2
0
ファイル: GPS.cs プロジェクト: jorgejavierfm/Wall-E
        public GPS(Map map)
        {
            this.Map = map;

             directionDict.Add(Components.Direction.North, new Point(-1, 0));
             directionDict.Add(Components.Direction.East, new Point(0, 1));
             directionDict.Add(Components.Direction.West, new Point(0, -1));
             directionDict.Add(Components.Direction.South, new Point(1, 0));
        }
コード例 #3
0
 /// <summary>
 /// Crea e inicializa un nuevo mapa.
 /// </summary>
 private void CreateMap()
 {
     newMapDialog = new DlgNewMap(cellList);
      if (cellList.Count > 0 && newMapDialog.ShowDialog() == DialogResult.OK)
      {
     map = new Map(newMapDialog.NewMapHeight, newMapDialog.NewMapWidth, cellList[newMapDialog.DefaultCellIndex]);
     ResizeBox();
      }
 }
コード例 #4
0
ファイル: Motor.cs プロジェクト: jorgejavierfm/Wall-E
        public Motor(Map map, Robot managedRobot)
        {
            Map = map;
             ManagedRobot = managedRobot;
             managedRobot.MoveOrTurn += map.OnSomethingMoves;

             directionDict.Add(Direction.North, new Point(-1, 0));
             directionDict.Add(Direction.East, new Point(0, 1));
             directionDict.Add(Direction.West, new Point(0, -1));
             directionDict.Add(Direction.South, new Point(1, 0));
        }
コード例 #5
0
ファイル: Scales.cs プロジェクト: jorgejavierfm/Wall-E
 public Scale(Map map)
 {
     this.Map = map;
 }
コード例 #6
0
ファイル: Thermometer.cs プロジェクト: jorgejavierfm/Wall-E
 public Thermometer(Map map)
 {
     this.Map = map;
 }
コード例 #7
0
ファイル: FormManual.cs プロジェクト: jorgejavierfm/Wall-E
 public FormManual(Map map, FormMain mainForm)
 {
     InitializeComponent();
      this.map = map;
      this.mainForm = mainForm;
 }
コード例 #8
0
ファイル: FormMain.cs プロジェクト: jorgejavierfm/Wall-E
        /// <summary>
        /// Carga un mapa de disco.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OpenMap_Click(object sender, EventArgs e)
        {
            if (openMapDialog.ShowDialog() == DialogResult.OK)
             {
            IFormatter formatter = new BinaryFormatter();
            Stream stream = new FileStream(openMapDialog.FileName, FileMode.Open, FileAccess.Read, FileShare.Read);
            map = (Map)formatter.Deserialize(stream);
            stream.Close();

            Size = new Size(map[0, 0].Image.Width * map.GetLength(1) + 9, map[0, 0].Image.Height * map.GetLength(0) + menuToolbar.Height + statusStrip.Height + mainToolStrip.Height + 32);

            map.Movement += MapSomethingMoved;
            map.Interaction += UpdateStatusText;
            map.Interaction += MapSomethingMoved;
            map.Robot.Motor.UnableToLoad += Robot_UnableToLoad;
            map.Robot.Motor.UnableToUnload += Robot_UnableToUnload;
            map.Robot.Motor.UnableToMove += Robot_UnableToMove;

            this.statusLabel.Text = "Event messages will appear here.";
            pboxCanvas.Image = null;
            pboxCanvas.Invalidate();
            statusStrip.Visible = true;
             }
        }
コード例 #9
0
        /// <summary>
        /// Carga un mapa de disco para modificarlo.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void menuOpenMap_Click(object sender, EventArgs e)
        {
            if (openMapDialog.ShowDialog() == DialogResult.OK){
            IFormatter formatter = new BinaryFormatter();
            Stream stream = new FileStream(openMapDialog.FileName, FileMode.Open, FileAccess.Read, FileShare.Read);
            map = (Map) formatter.Deserialize(stream);
            stream.Close();

            cellList = map.FieldPalette;
            itemList = map.ItemPalette;

            UpdateCellList();
            UpdateItemList();
             }
             ResizeBox();
             pboxGrid.Invalidate();
        }
コード例 #10
0
 /// <summary>
 /// Cierra el mapa actual.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void menuCloseMap_Click(object sender, EventArgs e)
 {
     map = null;
      pboxGrid.Invalidate();
 }
コード例 #11
0
ファイル: Webcam.cs プロジェクト: jorgejavierfm/Wall-E
 public Webcam(Map map)
 {
     this.Map = map;
 }
コード例 #12
0
ファイル: Robot.cs プロジェクト: jorgejavierfm/Wall-E
        /// <summary>
        /// "Posiciona" al robot en un mapa (inicializa sus sensores, etc.).
        /// </summary>
        /// <param name="map">El mapa donde se va a colocar el robot.</param>
        /// <param name="where">Donde exactamente se va a ubicar.</param>
        public void PlaceInMap(Map map, Point where)
        {
            if (map.HasRobot){
            map[where.X, where.Y].Item = this;
            if (map[where.X, where.Y].Item != this || (map.RobotLocation.X == where.X && map.RobotLocation.Y == where.Y))
               return;
            else{
               map[map.RobotLocation.X, map.RobotLocation.Y].Item = null;
               map.RobotLocation = new Point(where.X,where.Y);
            }
             }
             else{
            map[where.X, where.Y].Item = this;
            map.RobotLocation = new Point(where.X, where.Y);
             }

             this.Motor = new Motor(map,this);
             this.Sensors = new Sensors.RobotSensors(map);
        }