private void PlotTiles(BaseCamera camera, int mousex, int mousey) { var map = MapEditorManager.CurrentMap; var rect = MapEditorManager.SelectedTilesRectangle; if (!ComponentHelpers.PointInBounds(camera, mousex, mousey)) return; MapPoint plotstart = camera.ScreenSpaceToWorldSpace(new ScreenPoint(mousex, mousey)).ToMapPoint(); for (int i = 0; i < rect.Width * rect.Height; i++) { int y = (i / rect.Width); int x = (i - (y * rect.Width)); MapPoint tilepoint = new MapPoint(plotstart.X + x, plotstart.Y + y); MapPoint sheetpoint = new MapPoint(rect.X + x, rect.Y + y); if (ComponentHelpers.PointInMap(map, tilepoint)) { var action = new PlaceTileAction(tilepoint.IntX, tilepoint.IntY, MapEditorManager.CurrentLayer, map.GetTileSetValue(sheetpoint)); action.Do(context); actionbuffer.Add(action); } } MapEditorManager.OnMapChanged(); }