예제 #1
0
        public bool IsEqualTo(TileCell cell)
        {
            if (X != cell.X || Y != cell.Y)
            {
                return(false);
            }
            if (Alpha.Equals(cell.Alpha) == false)
            {
                return(false);
            }
            if (Rotation.Equals(cell.Rotation) == false)
            {
                return(false);
            }
            if (AutoTextureType != cell.AutoTextureType)
            {
                return(false);
            }
            if (FlipEffect != cell.FlipEffect)
            {
                return(false);
            }

            return(TextureSource.IsEqualTo(cell.TextureSource));
        }
예제 #2
0
        public object Clone()
        {
            var newCell = new TileCell(new Point2D(X, Y), TextureSource, Alpha, Rotation)
            {
                AutoTextureType = AutoTextureType,
                FlipEffect      = FlipEffect
            };

            return(newCell);
        }
예제 #3
0
		/// <exception cref="Exception">Failed to load texture tileset</exception>
		public Texture2D LoadTexture(TileCell cell = null) {
			if (mTexture == null) {
				if (cell == null) {
					throw new Exception("Need a cell to load autotile or non autotile source");
				}

				mTexture = cell.IsAutoTexture ? EngineCore.ContentLoader.GetAutotile(TextureIndex) : EngineCore.ContentLoader.GetTileset(TextureIndex);
			}
			if (mTexture == null) {
				throw new Exception("Failed to load texture tileset");
			}

			return mTexture;
		}
예제 #4
0
        /// <exception cref="Exception">Failed to load texture tileset</exception>
        public Texture2D LoadTexture(TileCell cell = null)
        {
            if (mTexture == null)
            {
                if (cell == null)
                {
                    throw new Exception("Need a cell to load autotile or non autotile source");
                }

                mTexture = cell.IsAutoTexture ? EngineCore.ContentLoader.GetAutotile(TextureIndex) : EngineCore.ContentLoader.GetTileset(TextureIndex);
            }
            if (mTexture == null)
            {
                throw new Exception("Failed to load texture tileset");
            }

            return(mTexture);
        }
예제 #5
0
		private bool SetCell(Point2D toPoint, TileCell toCell, bool GroupDraw) {
			var oldCell = GetCell(toPoint);
			if (toCell.IsEqualTo(oldCell)) {
				return false;
			}
			if (GroupDraw == false) {
				UndoAdd(toCell, oldCell, toPoint);
			}

			mTileMap.Layers[mCurrentLayer].SetCell(toPoint, toCell);
			mTileMap.Layers[mCurrentLayer][toPoint].LoadContent(EngineCore.ContentLoader.XnaContent);
			if (GroupDraw == false) {
				UpdateAutoTiles(toPoint, false);
			}
			return true;
		}
예제 #6
0
		private void SetAutotileType(Point2D startPoint, string autoIndex, ref List<Point2D> doneCells, ref List<UndoAction> undoCells) {
			TileCell cellBefore;
			var p = new Point2D(startPoint.X, startPoint.Y);
			if (doneCells.Contains(startPoint)) {
				return;
			}

			doneCells.Add(p);

			var thisCell = mTileMap.Layers[mCurrentLayer].GetCell(startPoint.X, startPoint.Y);
			var cellTop = mTileMap.Layers[mCurrentLayer].GetCell(startPoint.X, startPoint.Y - 1);
			var cellBottom = mTileMap.Layers[mCurrentLayer].GetCell(startPoint.X, startPoint.Y + 1);
			var cellLeft = mTileMap.Layers[mCurrentLayer].GetCell(startPoint.X - 1, startPoint.Y);
			var cellRight = mTileMap.Layers[mCurrentLayer].GetCell(startPoint.X + 1, startPoint.Y);
			var cellTopLeft = mTileMap.Layers[mCurrentLayer].GetCell(startPoint.X - 1, startPoint.Y - 1);
			var cellTopRight = mTileMap.Layers[mCurrentLayer].GetCell(startPoint.X + 1, startPoint.Y - 1);
			var cellBottomLeft = mTileMap.Layers[mCurrentLayer].GetCell(startPoint.X - 1, startPoint.Y + 1);
			var cellBottomRight = mTileMap.Layers[mCurrentLayer].GetCell(startPoint.X + 1, startPoint.Y + 1);

			var isAutoTile = (thisCell.IsAutoTexture && thisCell.TextureSource.TextureIndex == autoIndex);
			var hasTop = (cellTop.IsAutoTexture && cellTop.TextureSource.TextureIndex == autoIndex);
			var hasBottom = (cellBottom.IsAutoTexture && cellBottom.TextureSource.TextureIndex == autoIndex);
			var hasLeft = (cellLeft.IsAutoTexture && cellLeft.TextureSource.TextureIndex == autoIndex);
			var hasRight = (cellRight.IsAutoTexture && cellRight.TextureSource.TextureIndex == autoIndex);
			var hasTopLeft = (cellTopLeft.IsAutoTexture && cellTopLeft.TextureSource.TextureIndex == autoIndex);
			var hasTopRight = (cellTopRight.IsAutoTexture && cellTopRight.TextureSource.TextureIndex == autoIndex);
			var hasBottomLeft = (cellBottomLeft.IsAutoTexture && cellBottomLeft.TextureSource.TextureIndex == autoIndex);
			var hasBottomRight = (cellBottomRight.IsAutoTexture && cellBottomRight.TextureSource.TextureIndex == autoIndex);

			var autoSource = new TileCellSource(autoIndex, 0, 0, Constants.TileWidth, Constants.TileHeight);
			var cell = new TileCell(Point2D.Zero, autoSource, 1f, 0f);

			// keine anliegenden Autotiles
			if (hasTop == false && hasBottom == false && hasLeft == false && hasRight == false && hasTopLeft == false && hasTopRight == false && hasBottomLeft == false && hasBottomRight == false) {
				cell.AutoTextureType = EAutoTileType.None; // reset Cell type
				if (isAutoTile) {
					cell.AutoTextureType = EAutoTileType.StandAlone;
					if (startPoint.X == 0) {
						cell.AutoTextureType |= EAutoTileType.Left | EAutoTileType.TopLeft | EAutoTileType.BottomLeft;
					}
					if (startPoint.Y == 0) {
						cell.AutoTextureType |= EAutoTileType.Top | EAutoTileType.TopLeft | EAutoTileType.TopRight;
					}
					if (startPoint.X >= mTileMap.Layers[mCurrentLayer].Width - 1) {
						cell.AutoTextureType |= EAutoTileType.Right | EAutoTileType.BottomRight | EAutoTileType.TopRight;
					}
					if (startPoint.Y >= mTileMap.Layers[mCurrentLayer].Height - 1) {
						cell.AutoTextureType |= EAutoTileType.Bottom | EAutoTileType.BottomLeft | EAutoTileType.BottomRight;
					}

					cellBefore = GetCell(p);
					if (SetCell(p, cell, true)) {
						undoCells.Add(new UndoAction(mCurrentLayer, cell, cellBefore, p));
					}
				}
				return;
			}

			// not alone in the Dark...
			cell.AutoTextureType = EAutoTileType.None;

			if (isAutoTile) {
				// say the Cell it has Autotiles on the Map Ending [open-end Autotile like RPG Maker XP]
				if (startPoint.X == 0) {
					cell.AutoTextureType |= EAutoTileType.Left | EAutoTileType.TopLeft | EAutoTileType.BottomLeft;
				}
				if (startPoint.Y == 0) {
					cell.AutoTextureType |= EAutoTileType.Top | EAutoTileType.TopLeft | EAutoTileType.TopRight;
				}
				if (startPoint.X >= mTileMap.Layers[mCurrentLayer].Width - 1) {
					cell.AutoTextureType |= EAutoTileType.Right | EAutoTileType.BottomRight | EAutoTileType.TopRight;
				}
				if (startPoint.Y >= mTileMap.Layers[mCurrentLayer].Height - 1) {
					cell.AutoTextureType |= EAutoTileType.Bottom | EAutoTileType.BottomLeft | EAutoTileType.BottomRight;
				}

				if (hasRight) {
					cell.AutoTextureType |= EAutoTileType.Right;
				}
				if (hasLeft) {
					cell.AutoTextureType |= EAutoTileType.Left;
				}
				if (hasTop) {
					cell.AutoTextureType |= EAutoTileType.Top;
				}
				if (hasBottom) {
					cell.AutoTextureType |= EAutoTileType.Bottom;
				}

				if (hasTopLeft) {
					cell.AutoTextureType |= EAutoTileType.TopLeft;
				}
				if (hasTopRight) {
					cell.AutoTextureType |= EAutoTileType.TopRight;
				}
				if (hasBottomLeft) {
					cell.AutoTextureType |= EAutoTileType.BottomLeft;
				}
				if (hasBottomRight) {
					cell.AutoTextureType |= EAutoTileType.BottomRight;
				}

				// nothing to update
				if (thisCell.AutoTextureType == cell.AutoTextureType) {
					return;
				}

				// set Cell Type
				cellBefore = GetCell(p);
				if (SetCell(p, cell, true)) {
					undoCells.Add(new UndoAction(mCurrentLayer, cell, cellBefore, p));
				}
			}


			// update other Cells
			if (hasRight) {
				SetAutotileType(new Point2D(startPoint.X + 1, startPoint.Y), autoIndex, ref doneCells, ref undoCells);
			}
			if (hasLeft) {
				SetAutotileType(new Point2D(startPoint.X - 1, startPoint.Y), autoIndex, ref doneCells, ref undoCells);
			}
			if (hasTop) {
				SetAutotileType(new Point2D(startPoint.X, startPoint.Y - 1), autoIndex, ref doneCells, ref undoCells);
			}
			if (hasBottom) {
				SetAutotileType(new Point2D(startPoint.X, startPoint.Y + 1), autoIndex, ref doneCells, ref undoCells);
			}

			if (hasTopLeft) {
				SetAutotileType(new Point2D(startPoint.X - 1, startPoint.Y - 1), autoIndex, ref doneCells, ref undoCells);
			}
			if (hasTopRight) {
				SetAutotileType(new Point2D(startPoint.X + 1, startPoint.Y - 1), autoIndex, ref doneCells, ref undoCells);
			}
			if (hasBottomLeft) {
				SetAutotileType(new Point2D(startPoint.X - 1, startPoint.Y + 1), autoIndex, ref doneCells, ref undoCells);
			}
			if (hasBottomRight) {
				SetAutotileType(new Point2D(startPoint.X + 1, startPoint.Y + 1), autoIndex, ref doneCells, ref undoCells);
			}

		}
예제 #7
0
		private void MoveTextures(XnaKeys key) {
			if (mMarkerRectangle == Rectangle.Empty || mCurrentLayer == -1 || mTileMap == null) {
				return;
			}

			Point2D moveAdd = Point2D.Zero, startPoint = Point2D.Zero;
			startPoint.X = mMarkerRectangle.X;
			startPoint.Y = mMarkerRectangle.Y;
			var endPoint = new Point2D(startPoint.X + mMarkerRectangle.Width, startPoint.Y + mMarkerRectangle.Height);

			var cells = new TileCell[endPoint.X - startPoint.X, endPoint.Y - startPoint.Y];
			for (var mapY = startPoint.Y; mapY < endPoint.Y; mapY++) {
				for (var mapX = startPoint.X; mapX < endPoint.X; mapX++) {
					cells[mapX - startPoint.X, mapY - startPoint.Y] = mTileMap.Layers[mCurrentLayer].GetCell(mapX, mapY);
				}
			}

			if (key == XnaKeys.Up) {
				moveAdd.Y = -1;
				for (var mapX = startPoint.X; mapX < endPoint.X; mapX++) {
					mTileMap.Layers[mCurrentLayer].SetCell(new Point2D(mapX, endPoint.Y - 1), TileCell.Empty);
				}
			} else if (key == XnaKeys.Left) {
				moveAdd.X = -1;
				for (var mapY = startPoint.Y; mapY < endPoint.Y; mapY++) {
					mTileMap.Layers[mCurrentLayer].SetCell(new Point2D(endPoint.X - 1, mapY), TileCell.Empty);
				}
			} else if (key == XnaKeys.Down) {
				moveAdd.Y = 1;
				for (var mapX = startPoint.X; mapX < endPoint.X; mapX++) {
					mTileMap.Layers[mCurrentLayer].SetCell(new Point2D(mapX, startPoint.Y), TileCell.Empty);
				}
			} else if (key == XnaKeys.Right) {
				moveAdd.X = 1;
				for (var mapY = startPoint.Y; mapY < endPoint.Y; mapY++) {
					mTileMap.Layers[mCurrentLayer].SetCell(new Point2D(startPoint.X, mapY), TileCell.Empty);
				}
			}

			// move saved Cells
			for (var mapY = startPoint.Y; mapY < endPoint.Y; mapY++) {
				for (var mapX = startPoint.X; mapX < endPoint.X; mapX++) {
					mTileMap.Layers[mCurrentLayer].SetCell(mapX + moveAdd.X, mapY + moveAdd.Y, cells[mapX - startPoint.X, mapY - startPoint.Y]);
				}
			}
			
			// move our rectangle
			mMarkerRectangle.X += moveAdd.X;
			mMarkerRectangle.Y += moveAdd.Y;
		}
예제 #8
0
		public UndoAction(int layer, TileCell to, TileCell from, Point p) {
			LayerID = layer;
			CellTo = (TileCell)to.Clone();
			CellFrom = (TileCell)from.Clone();
			Point = p;
		}
예제 #9
0
		public object Clone() {
			var newCell = new TileCell(new Point2D(X, Y), TextureSource, Alpha, Rotation) {
				AutoTextureType = AutoTextureType,
				FlipEffect = FlipEffect
			};
			return newCell;
		}
예제 #10
0
		public bool SetCell(Point point, TileCell cell) {
			return SetCell(point.X, point.Y, cell);
		}
예제 #11
0
		private void UndoAdd(TileCell to, TileCell from, Point2D p) {
			var items = new List<UndoAction>();
			items.Add(new UndoAction(mCurrentLayer, to, from, p));
			UndoAdd(items);
		}
예제 #12
0
		public TileLayer(TileCell[][] existingMap) {
			mLayoutMap = (TileCell[][])existingMap.Clone();
		}
예제 #13
0
		public TileLayer(int width, int height) {
			mLayoutMap = new TileCell[width][];

			for (int x = 0; x < width; x++) {
				mLayoutMap[x] = new TileCell[height];
				for (int y = 0; y < height; y++) {
					mLayoutMap[x][y] = TileCell.Empty;
					mLayoutMap[x][y].X = x;
					mLayoutMap[x][y].Y = y;
				}
			}
		}
예제 #14
0
 public TileCell(TileCell oldCell) :
     this(new Point2D(oldCell.X, oldCell.Y), oldCell.TextureSource, oldCell.Alpha, oldCell.Rotation)
 {
     AutoTextureType = oldCell.AutoTextureType;
     FlipEffect      = oldCell.FlipEffect;
 }
예제 #15
0
		public void DrawAutotile(SpriteBatch batch, IEngineCamera camera, TileCell cell, Texture2D texture, Point drawTo, Point preDraw) {
			var color = new Color(new Vector4(1f, 1f, 1f, Alpha));
			var cellType = cell.AutoTextureType;
			var partWidth = camera.TileWidth / 2;
			var partHeight = camera.TileHeight / 2;
			var partWidthConst = TileCell.TileWidth / 2;
			var partheightConst = TileCell.TileHeight / 2;

			if (preDraw != mMinusOne)
				drawTo = preDraw;

			var sourceRect = new Rectangle(cell.X, cell.Y, cell.Width, cell.Height);
			var destRect = new Rectangle(drawTo.X * camera.TileWidth, drawTo.Y * camera.TileHeight, camera.TileWidth, camera.TileHeight);

			// keine anliegenden
			if (cellType.Has(EAutoTileType.StandAlone | EAutoTileType.BottomLeft | EAutoTileType.BottomRight | EAutoTileType.TopLeft | EAutoTileType.TopRight) && cellType.HasNot(EAutoTileType.Bottom | EAutoTileType.Left | EAutoTileType.Right | EAutoTileType.Top)) {
				batch.Draw(texture, destRect, sourceRect, color);
				return;
			}
			#region nur Rechts, Rechts + UntenRechts, Rechts + ObenRechts
			if (cellType.Has(EAutoTileType.Right) && cellType.HasNot(EAutoTileType.Left | EAutoTileType.Top | EAutoTileType.Bottom)) {
				// linkes Eck
				sourceRect = new Rectangle(0, 0, partWidthConst, TileCell.TileHeight);
				destRect = new Rectangle(drawTo.X * camera.TileWidth, drawTo.Y * camera.TileHeight, partWidth, camera.TileHeight);
				batch.Draw(texture, destRect, sourceRect, color);

				// Mitte oben
				sourceRect = new Rectangle(TileCell.TileWidth, TileCell.TileHeight, partWidthConst, partheightConst);
				destRect = new Rectangle(drawTo.X * camera.TileWidth + partWidth, drawTo.Y * camera.TileHeight, partWidth, partHeight);
				batch.Draw(texture, destRect, sourceRect, color);

				// Mitte unten
				sourceRect = new Rectangle(TileCell.TileWidth, texture.Height - partheightConst, partWidthConst, partheightConst);
				destRect = new Rectangle(drawTo.X * camera.TileWidth + partWidth, drawTo.Y * camera.TileHeight + partHeight, partWidth, partHeight);
				batch.Draw(texture, destRect, sourceRect, color);
				return;
			}
			#endregion
			#region nur Links, Links + UntenLinks, Links + ObenLinks
			if (cellType.Has(EAutoTileType.Left) && cellType.HasNot(EAutoTileType.Top | EAutoTileType.Bottom | EAutoTileType.Right)) {
				// rechtes Eck
				sourceRect = new Rectangle(partWidthConst, 0, partWidthConst, TileCell.TileHeight);
				destRect = new Rectangle(drawTo.X * camera.TileWidth + partWidth, drawTo.Y * camera.TileHeight, partWidth, camera.TileHeight);
				batch.Draw(texture, destRect, sourceRect, color);

				// Mitte oben
				sourceRect = new Rectangle(TileCell.TileWidth, TileCell.TileHeight, partWidthConst, partheightConst);
				destRect = new Rectangle(drawTo.X * camera.TileWidth, drawTo.Y * camera.TileHeight, partWidth, partHeight);
				batch.Draw(texture, destRect, sourceRect, color);

				// Mitte unten
				sourceRect = new Rectangle(TileCell.TileWidth, texture.Height - partheightConst, partWidthConst, partheightConst);
				destRect = new Rectangle(drawTo.X * camera.TileWidth, drawTo.Y * camera.TileHeight + partHeight, partWidth, partHeight);
				batch.Draw(texture, destRect, sourceRect, color);
				return;
			}
			#endregion

			#region Rechts und Links, kein Oben und Unten
			if (cellType.HasAll(EAutoTileType.Right | EAutoTileType.Left) && cellType.HasNot(EAutoTileType.Top | EAutoTileType.Bottom)) {
				// Mitte oben
				sourceRect = new Rectangle(TileCell.TileWidth, TileCell.TileHeight, TileCell.TileWidth, partheightConst);
				destRect = new Rectangle(drawTo.X * camera.TileWidth, drawTo.Y * camera.TileHeight, camera.TileWidth, partHeight);
				batch.Draw(texture, destRect, sourceRect, color);

				// Mitte unten
				sourceRect = new Rectangle(TileCell.TileWidth, texture.Height - partheightConst, TileCell.TileWidth, partheightConst);
				destRect = new Rectangle(drawTo.X * camera.TileWidth, drawTo.Y * camera.TileHeight + partHeight, camera.TileWidth, partHeight);
				batch.Draw(texture, destRect, sourceRect, color);
				return;
			}
			#endregion
			#region Oben und Unten, kein Links und Rechts
			if (cellType.HasAll(EAutoTileType.Bottom | EAutoTileType.Top) && cellType.HasNot(EAutoTileType.Left | EAutoTileType.Right)) {
				// Mitte links
				sourceRect = new Rectangle(0, texture.Height - TileCell.TileHeight - partheightConst, partWidthConst, TileCell.TileHeight);
				destRect = new Rectangle(drawTo.X * camera.TileWidth, drawTo.Y * camera.TileHeight, partWidth, camera.TileHeight);
				batch.Draw(texture, destRect, sourceRect, color);

				// Mitte rechts
				sourceRect = new Rectangle(TileCell.TileWidth * 2 + partWidthConst, texture.Height - TileCell.TileHeight - partheightConst, partWidthConst, TileCell.TileHeight);
				destRect = new Rectangle(drawTo.X * camera.TileWidth + partWidth, drawTo.Y * camera.TileHeight, partWidth, camera.TileHeight);
				batch.Draw(texture, destRect, sourceRect, color);
				return;
			}
			#endregion

			#region nur Oben, Oben + ObenLink, Oben + ObenRechts, Oben + ObenLinks + ObenRechts
			if (cellType.Has(EAutoTileType.Top) && cellType.HasNot(EAutoTileType.Bottom | EAutoTileType.Left | EAutoTileType.Right)) {
				// unteres Eck
				sourceRect = new Rectangle(0, partheightConst, TileCell.TileWidth, partheightConst);
				destRect = new Rectangle(drawTo.X * camera.TileWidth, drawTo.Y * camera.TileHeight + partHeight, camera.TileWidth, partHeight);
				batch.Draw(texture, destRect, sourceRect, color);

				// Mitte links
				sourceRect = new Rectangle(0, texture.Height - TileCell.TileHeight - partheightConst, partWidthConst, partheightConst);
				destRect = new Rectangle(drawTo.X * camera.TileWidth, drawTo.Y * camera.TileHeight, partWidth, partHeight);
				batch.Draw(texture, destRect, sourceRect, color);

				// Mitte rechts
				sourceRect = new Rectangle(TileCell.TileWidth * 2 + partWidthConst, texture.Height - TileCell.TileHeight - partheightConst, partWidthConst, partheightConst);
				destRect = new Rectangle(drawTo.X * camera.TileWidth + partWidth, drawTo.Y * camera.TileHeight, partWidth, partHeight);
				batch.Draw(texture, destRect, sourceRect, color);
				return;
			}
			#endregion
			#region nur Unten, Unten + UntenLink, Unten + UntenRechts, Unten + UntenLinks + UntenRechts
			if (cellType.Has(EAutoTileType.Bottom) && cellType.HasNot(EAutoTileType.Top | EAutoTileType.Left | EAutoTileType.Right)) {
				// oberes Eck
				sourceRect = new Rectangle(0, 0, TileCell.TileWidth, partheightConst);
				destRect = new Rectangle(drawTo.X * camera.TileWidth, drawTo.Y * camera.TileHeight, camera.TileWidth, partHeight);
				batch.Draw(texture, destRect, sourceRect, color);

				// Mitte links
				sourceRect = new Rectangle(0, texture.Height - TileCell.TileHeight - partheightConst, partWidthConst, partheightConst);
				destRect = new Rectangle(drawTo.X * camera.TileWidth, drawTo.Y * camera.TileHeight + partHeight, partWidth, partHeight);
				batch.Draw(texture, destRect, sourceRect, color);

				// Mitte rechts
				sourceRect = new Rectangle(TileCell.TileWidth * 2 + partWidthConst, texture.Height - TileCell.TileHeight - partheightConst, partWidthConst, partheightConst);
				destRect = new Rectangle(drawTo.X * camera.TileWidth + partWidth, drawTo.Y * camera.TileHeight + partHeight, partWidth, partHeight);
				batch.Draw(texture, destRect, sourceRect, color);
				return;
			}
			#endregion

			#region T-Kreuzung nach Unten (Links + Rechts + Unten)
			if (cellType.HasAll(EAutoTileType.Left | EAutoTileType.Right | EAutoTileType.Bottom) && cellType.HasNot(EAutoTileType.Top | EAutoTileType.BottomLeft | EAutoTileType.BottomRight)) {
				// obere Kante
				sourceRect = new Rectangle(TileCell.TileWidth, TileCell.TileHeight, TileCell.TileWidth, partheightConst);
				destRect = new Rectangle(drawTo.X * camera.TileWidth, drawTo.Y * camera.TileHeight, camera.TileWidth, partHeight);
				batch.Draw(texture, destRect, sourceRect, color);

				// unten
				sourceRect = new Rectangle(TileCell.TileWidth * 2, partheightConst, TileCell.TileWidth, partheightConst);
				destRect = new Rectangle(drawTo.X * camera.TileWidth, drawTo.Y * camera.TileHeight + partHeight, camera.TileWidth, partHeight);
				batch.Draw(texture, destRect, sourceRect, color);
				return;
			}
			#endregion
			#region T-Kreuzung nach Oben (Links + Rechts + Oben)
			if (cellType.HasAll(EAutoTileType.Left | EAutoTileType.Right | EAutoTileType.Top) && cellType.HasNot(EAutoTileType.Bottom | EAutoTileType.TopLeft | EAutoTileType.TopRight)) {
				// untere Kante
				sourceRect = new Rectangle(TileCell.TileWidth, texture.Height - partheightConst, TileCell.TileWidth, partheightConst);
				destRect = new Rectangle(drawTo.X * camera.TileWidth, drawTo.Y * camera.TileHeight + partHeight, camera.TileWidth, partHeight);
				batch.Draw(texture, destRect, sourceRect, color);

				// oben
				sourceRect = new Rectangle(TileCell.TileWidth * 2, 0, TileCell.TileWidth, partheightConst);
				destRect = new Rectangle(drawTo.X * camera.TileWidth, drawTo.Y * camera.TileHeight, camera.TileWidth, partHeight);
				batch.Draw(texture, destRect, sourceRect, color);
				return;
			}
			#endregion
			#region T-Kreuzung nach Links (Oben + Unten + Links)
			if (cellType.HasAll(EAutoTileType.Top | EAutoTileType.Bottom | EAutoTileType.Left) && cellType.HasNot(EAutoTileType.Right | EAutoTileType.BottomLeft | EAutoTileType.TopLeft)) {
				// rechte Kante
				sourceRect = new Rectangle(TileCell.TileWidth * 2 + partWidthConst, texture.Height - TileCell.TileHeight * 2, partWidthConst, TileCell.TileHeight);
				destRect = new Rectangle(drawTo.X * camera.TileWidth + partWidth, drawTo.Y * camera.TileHeight, partWidth, camera.TileHeight);
				batch.Draw(texture, destRect, sourceRect, color);

				// links
				sourceRect = new Rectangle(TileCell.TileWidth * 2, 0, partWidthConst, TileCell.TileHeight);
				destRect = new Rectangle(drawTo.X * camera.TileWidth, drawTo.Y * camera.TileHeight, partWidth, camera.TileHeight);
				batch.Draw(texture, destRect, sourceRect, color);
				return;
			}
			#endregion
			#region T-Kreuzung nach Rechts (Oben + Unten + Rechts)
			if (cellType.HasAll(EAutoTileType.Top | EAutoTileType.Bottom | EAutoTileType.Right) && cellType.HasNot(EAutoTileType.Left | EAutoTileType.TopRight | EAutoTileType.BottomRight)) {
				// linke Kante
				sourceRect = new Rectangle(0, texture.Height - TileCell.TileHeight * 2, partWidthConst, TileCell.TileHeight);
				destRect = new Rectangle(drawTo.X * camera.TileWidth, drawTo.Y * camera.TileHeight, partWidth, camera.TileHeight);
				batch.Draw(texture, destRect, sourceRect, color);

				// rechts
				sourceRect = new Rectangle(TileCell.TileWidth * 2 + partWidthConst, 0, partWidthConst, TileCell.TileHeight);
				destRect = new Rectangle(drawTo.X * camera.TileWidth + partWidth, drawTo.Y * camera.TileHeight, partWidth, camera.TileHeight);
				batch.Draw(texture, destRect, sourceRect, color);
				return;
			}
			#endregion

			#region Kreuz (Oben + Unten + Links + Rechts)
			if (cellType.HasAll(EAutoTileType.Top | EAutoTileType.Bottom | EAutoTileType.Right | EAutoTileType.Left) && cellType.HasNot(EAutoTileType.BottomLeft | EAutoTileType.BottomRight | EAutoTileType.TopLeft | EAutoTileType.TopRight)) {
				// mitte
				sourceRect = new Rectangle(TileCell.TileWidth * 2, 0, TileCell.TileWidth, TileCell.TileHeight);
				destRect = new Rectangle(drawTo.X * camera.TileWidth, drawTo.Y * camera.TileHeight, camera.TileWidth, camera.TileHeight);
				batch.Draw(texture, destRect, sourceRect, color);
				return;
			}
			#endregion

			#region Kreuz + Oben Links (Oben + Unten + Links + Rechts)
			if (cellType.HasAll(EAutoTileType.Top | EAutoTileType.Bottom | EAutoTileType.Right | EAutoTileType.Left | EAutoTileType.TopLeft) && cellType.HasNot(EAutoTileType.BottomLeft | EAutoTileType.BottomRight | EAutoTileType.TopRight)) {
				// untere Kante
				sourceRect = new Rectangle(TileCell.TileWidth * 2, partheightConst, TileCell.TileWidth, partheightConst);
				destRect = new Rectangle(drawTo.X * camera.TileWidth, drawTo.Y * camera.TileHeight + partHeight, camera.TileWidth, partHeight);
				batch.Draw(texture, destRect, sourceRect, color);

				// oben links
				sourceRect = new Rectangle(TileCell.TileWidth, TileCell.TileHeight * 2, partWidthConst, partheightConst);
				destRect = new Rectangle(drawTo.X * camera.TileWidth, drawTo.Y * camera.TileHeight, partWidth, partHeight);
				batch.Draw(texture, destRect, sourceRect, color);

				// oben rechts
				sourceRect = new Rectangle(TileCell.TileWidth * 2 + partWidthConst, 0, partWidthConst, partheightConst);
				destRect = new Rectangle(drawTo.X * camera.TileWidth + partWidth, drawTo.Y * camera.TileHeight, partWidth, partHeight);
				batch.Draw(texture, destRect, sourceRect, color);
				return;
			}
			#endregion
			#region Kreuz + Oben Rechts (Oben + Unten + Links + Rechts)
			if (cellType.HasAll(EAutoTileType.Top | EAutoTileType.Bottom | EAutoTileType.Right | EAutoTileType.Left | EAutoTileType.TopRight) && cellType.HasNot(EAutoTileType.BottomLeft | EAutoTileType.BottomRight | EAutoTileType.TopLeft)) {
				// untere Kante
				sourceRect = new Rectangle(TileCell.TileWidth * 2, partheightConst, TileCell.TileWidth, partheightConst);
				destRect = new Rectangle(drawTo.X * camera.TileWidth, drawTo.Y * camera.TileHeight + partHeight, camera.TileWidth, partHeight);
				batch.Draw(texture, destRect, sourceRect, color);

				// oben links
				sourceRect = new Rectangle(TileCell.TileWidth * 2, 0, partWidthConst, partheightConst);
				destRect = new Rectangle(drawTo.X * camera.TileWidth, drawTo.Y * camera.TileHeight, partWidth, partHeight);
				batch.Draw(texture, destRect, sourceRect, color);

				// oben rechts
				sourceRect = new Rectangle(TileCell.TileWidth, TileCell.TileHeight * 2, partWidthConst, partheightConst);
				destRect = new Rectangle(drawTo.X * camera.TileWidth + partWidth, drawTo.Y * camera.TileHeight, partWidth, partHeight);
				batch.Draw(texture, destRect, sourceRect, color);
				return;
			}
			#endregion
			#region Kreuz + Unten Links (Oben + Unten + Links + Rechts)
			if (cellType.HasAll(EAutoTileType.Top | EAutoTileType.Bottom | EAutoTileType.Right | EAutoTileType.Left | EAutoTileType.BottomRight) && cellType.HasNot(EAutoTileType.TopLeft | EAutoTileType.TopRight | EAutoTileType.BottomLeft)) {
				// obere Kante
				sourceRect = new Rectangle(TileCell.TileWidth * 2, 0, TileCell.TileWidth, partheightConst);
				destRect = new Rectangle(drawTo.X * camera.TileWidth, drawTo.Y * camera.TileHeight, camera.TileWidth, partHeight);
				batch.Draw(texture, destRect, sourceRect, color);

				// unten links
				sourceRect = new Rectangle(TileCell.TileWidth * 2, partheightConst, partWidthConst, partheightConst);
				destRect = new Rectangle(drawTo.X * camera.TileWidth, drawTo.Y * camera.TileHeight + partHeight, partWidth, partHeight);
				batch.Draw(texture, destRect, sourceRect, color);

				// unten rechts
				sourceRect = new Rectangle(TileCell.TileWidth, TileCell.TileHeight * 2, partWidthConst, partheightConst);
				destRect = new Rectangle(drawTo.X * camera.TileWidth + partWidth, drawTo.Y * camera.TileHeight + partHeight, partWidth, partHeight);
				batch.Draw(texture, destRect, sourceRect, color);
				return;
			}
			#endregion
			#region Kreuz + Unten Rechts (Oben + Unten + Links + Rechts)
			if (cellType.HasAll(EAutoTileType.Top | EAutoTileType.Bottom | EAutoTileType.Right | EAutoTileType.Left | EAutoTileType.BottomLeft) && cellType.HasNot(EAutoTileType.TopLeft | EAutoTileType.TopRight | EAutoTileType.BottomRight)) {
				// obere Kante
				sourceRect = new Rectangle(TileCell.TileWidth * 2, 0, TileCell.TileWidth, partheightConst);
				destRect = new Rectangle(drawTo.X * camera.TileWidth, drawTo.Y * camera.TileHeight, camera.TileWidth, partHeight);
				batch.Draw(texture, destRect, sourceRect, color);

				// unten links
				sourceRect = new Rectangle(TileCell.TileWidth, TileCell.TileHeight * 2, partWidthConst, partheightConst);
				destRect = new Rectangle(drawTo.X * camera.TileWidth, drawTo.Y * camera.TileHeight + partHeight, partWidth, partHeight);
				batch.Draw(texture, destRect, sourceRect, color);

				// unten rechts
				sourceRect = new Rectangle(TileCell.TileWidth * 2 + partWidthConst, partheightConst, partWidthConst, partheightConst);
				destRect = new Rectangle(drawTo.X * camera.TileWidth + partWidth, drawTo.Y * camera.TileHeight + partHeight, partWidth, partHeight);
				batch.Draw(texture, destRect, sourceRect, color);
				return;
			}
			#endregion

			#region Ecke unten links (Oben + Rechts)
			if (cellType.HasAll(EAutoTileType.Top | EAutoTileType.Right) && cellType.HasNot(EAutoTileType.Left | EAutoTileType.Bottom | EAutoTileType.TopRight)) {
				// Ecke unten Links 32drawTo.X16
				sourceRect = new Rectangle(0, texture.Height - partheightConst, TileCell.TileWidth, partheightConst);
				destRect = new Rectangle(drawTo.X * camera.TileWidth, drawTo.Y * camera.TileHeight + partHeight, camera.TileWidth, partHeight);
				batch.Draw(texture, destRect, sourceRect, color);

				// Ecke oben Links 16drawTo.X16
				sourceRect = new Rectangle(0, texture.Height - TileCell.TileHeight, partWidthConst, partheightConst);
				destRect = new Rectangle(drawTo.X * camera.TileWidth, drawTo.Y * camera.TileHeight, partWidth, partHeight);
				batch.Draw(texture, destRect, sourceRect, color);

				// Ecke oben Rechts 16drawTo.X16
				sourceRect = new Rectangle(TileCell.TileWidth * 2 + partWidthConst, 0, partWidthConst, partheightConst);
				destRect = new Rectangle(drawTo.X * camera.TileWidth + partWidth, drawTo.Y * camera.TileHeight, partWidth, partHeight);
				batch.Draw(texture, destRect, sourceRect, color);
				return;
			}
			#endregion
			#region Ecke unten rechts (Oben + Links)
			if (cellType.HasAll(EAutoTileType.Top | EAutoTileType.Left) && cellType.HasNot(EAutoTileType.Right | EAutoTileType.Bottom | EAutoTileType.TopLeft)) {
				// Ecke unten Rechts 32drawTo.X16
				sourceRect = new Rectangle(TileCell.TileWidth * 2, texture.Height - partheightConst, TileCell.TileWidth, partheightConst);
				destRect = new Rectangle(drawTo.X * camera.TileWidth, drawTo.Y * camera.TileHeight + partHeight, camera.TileWidth, partHeight);
				batch.Draw(texture, destRect, sourceRect, color);

				// Ecke oben Rechts 16drawTo.X16
				sourceRect = new Rectangle(TileCell.TileWidth * 2 + partWidthConst, texture.Height - TileCell.TileHeight, partWidthConst, partheightConst);
				destRect = new Rectangle(drawTo.X * camera.TileWidth + partWidth, drawTo.Y * camera.TileHeight, partWidth, partHeight);
				batch.Draw(texture, destRect, sourceRect, color);

				// Ecke oben Links 16drawTo.X16
				sourceRect = new Rectangle(TileCell.TileWidth * 2, 0, partWidthConst, partheightConst);
				destRect = new Rectangle(drawTo.X * camera.TileWidth, drawTo.Y * camera.TileHeight, partWidth, partHeight);
				batch.Draw(texture, destRect, sourceRect, color);
				return;
			}
			#endregion
			#region Ecke oben links (Unten + Rechts)
			if (cellType.HasAll(EAutoTileType.Bottom | EAutoTileType.Right) && cellType.HasNot(EAutoTileType.Top | EAutoTileType.Left | EAutoTileType.BottomRight)) {
				// Ecke oben Links 32drawTo.X16
				sourceRect = new Rectangle(0, TileCell.TileHeight, TileCell.TileWidth, partheightConst);
				destRect = new Rectangle(drawTo.X * camera.TileWidth, drawTo.Y * camera.TileHeight, camera.TileWidth, partHeight);
				batch.Draw(texture, destRect, sourceRect, color);

				// Ecke unten Links 16drawTo.X16
				sourceRect = new Rectangle(0, TileCell.TileHeight + partheightConst, partWidthConst, partheightConst);
				destRect = new Rectangle(drawTo.X * camera.TileWidth, drawTo.Y * camera.TileHeight + partHeight, partWidth, partHeight);
				batch.Draw(texture, destRect, sourceRect, color);

				// Ecke unten Rechts 16drawTo.X16
				sourceRect = new Rectangle(TileCell.TileWidth * 2 + partWidthConst, partheightConst, partWidthConst, partheightConst);
				destRect = new Rectangle(drawTo.X * camera.TileWidth + partWidth, drawTo.Y * camera.TileHeight + partHeight, partWidth, partHeight);
				batch.Draw(texture, destRect, sourceRect, color);
				return;
			}
			#endregion
			#region Ecke oben rechts (Unten + Links)
			if (cellType.HasAll(EAutoTileType.Bottom | EAutoTileType.Left) && cellType.HasNot(EAutoTileType.Right | EAutoTileType.Top | EAutoTileType.BottomLeft)) {
				// Ecke oben Rechts 32drawTo.X16
				sourceRect = new Rectangle(TileCell.TileWidth * 2, TileCell.TileHeight, TileCell.TileWidth, partheightConst);
				destRect = new Rectangle(drawTo.X * camera.TileWidth, drawTo.Y * camera.TileHeight, camera.TileWidth, partHeight);
				batch.Draw(texture, destRect, sourceRect, color);

				// Ecke unten Rechts 16drawTo.X16
				sourceRect = new Rectangle(TileCell.TileWidth * 2 + partWidthConst, TileCell.TileHeight + partheightConst, partWidthConst, partheightConst);
				destRect = new Rectangle(drawTo.X * camera.TileWidth + partWidth, drawTo.Y * camera.TileHeight + partHeight, partWidth, partHeight);
				batch.Draw(texture, destRect, sourceRect, color);

				// Ecke unten Links 16drawTo.X16
				sourceRect = new Rectangle(TileCell.TileWidth * 2, partheightConst, partWidthConst, partheightConst);
				destRect = new Rectangle(drawTo.X * camera.TileWidth, drawTo.Y * camera.TileHeight + partHeight, partWidth, partHeight);
				batch.Draw(texture, destRect, sourceRect, color);
				return;
			}
			#endregion

			#region Ecke links oben + diagonal (Unten + Rechts + UntenRechts)
			if (cellType.HasAll(EAutoTileType.Bottom | EAutoTileType.Right | EAutoTileType.BottomRight) && cellType.HasNot(EAutoTileType.Top | EAutoTileType.Left)) {
				sourceRect = new Rectangle(0, TileCell.TileHeight, TileCell.TileWidth, TileCell.TileHeight);
				destRect = new Rectangle(drawTo.X * camera.TileWidth, drawTo.Y * camera.TileHeight, camera.TileWidth, camera.TileHeight);
				batch.Draw(texture, destRect, sourceRect, color);
				return;
			}
			#endregion
			#region Ecke rechts oben + diagonal (Unten + Links + UntenLinks)
			if (cellType.HasAll(EAutoTileType.Bottom | EAutoTileType.Left | EAutoTileType.BottomLeft) && cellType.HasNot(EAutoTileType.Top | EAutoTileType.Right)) {
				sourceRect = new Rectangle(TileCell.TileWidth * 2, TileCell.TileHeight, TileCell.TileWidth, TileCell.TileHeight);
				destRect = new Rectangle(drawTo.X * camera.TileWidth, drawTo.Y * camera.TileHeight, camera.TileWidth, camera.TileHeight);
				batch.Draw(texture, destRect, sourceRect, color);
				return;
			}
			#endregion
			#region Ecke links unten + diagonal (Oben + Rechts + ObenRechts)
			if (cellType.HasAll(EAutoTileType.Top | EAutoTileType.Right | EAutoTileType.TopRight) && cellType.HasNot(EAutoTileType.Bottom | EAutoTileType.Left)) {
				sourceRect = new Rectangle(0, texture.Height - TileCell.TileHeight, TileCell.TileWidth, TileCell.TileHeight);
				destRect = new Rectangle(drawTo.X * camera.TileWidth, drawTo.Y * camera.TileHeight, camera.TileWidth, camera.TileHeight);
				batch.Draw(texture, destRect, sourceRect, color);
				return;
			}
			#endregion
			#region Ecke rechts unten + diagonal (Oben + Links + ObenLinks)
			if (cellType.HasAll(EAutoTileType.Top | EAutoTileType.Left | EAutoTileType.TopLeft) && cellType.HasNot(EAutoTileType.Bottom | EAutoTileType.Right)) {
				sourceRect = new Rectangle(TileCell.TileWidth * 2, texture.Height - TileCell.TileHeight, TileCell.TileWidth, TileCell.TileHeight);
				destRect = new Rectangle(drawTo.X * camera.TileWidth, drawTo.Y * camera.TileHeight, camera.TileWidth, camera.TileHeight);
				batch.Draw(texture, destRect, sourceRect, color);
				return;
			}
			#endregion

			#region Seiten links mitte + diagonalen (Oben + Unten + Rechts + ObenRechts + UntenRechts)
			if (cellType.HasAll(EAutoTileType.Top | EAutoTileType.Bottom | EAutoTileType.Right | EAutoTileType.BottomRight | EAutoTileType.TopRight) && cellType.HasNot(EAutoTileType.Left)) {
				sourceRect = new Rectangle(0, texture.Height - TileCell.TileHeight * 2, TileCell.TileWidth, TileCell.TileHeight);
				destRect = new Rectangle(drawTo.X * camera.TileWidth, drawTo.Y * camera.TileHeight, camera.TileWidth, camera.TileHeight);
				batch.Draw(texture, destRect, sourceRect, color);
				return;
			}
			#endregion
			#region Seiten rechts mitte + diagonalen (Oben + Unten + Links + ObenLinks + UntenLinks)
			if (cellType.HasAll(EAutoTileType.Top | EAutoTileType.Bottom | EAutoTileType.Left | EAutoTileType.BottomLeft | EAutoTileType.TopLeft) && cellType.HasNot(EAutoTileType.Right)) {
				sourceRect = new Rectangle(TileCell.TileWidth * 2, texture.Height - TileCell.TileHeight * 2, TileCell.TileWidth, TileCell.TileHeight);
				destRect = new Rectangle(drawTo.X * camera.TileWidth, drawTo.Y * camera.TileHeight, camera.TileWidth, camera.TileHeight);
				batch.Draw(texture, destRect, sourceRect, color);
				return;
			}
			#endregion
			#region Seiten oben mitte + diagonalen (Links + Rechts + Unten + UntenLinks + UntenRechts)
			if (cellType.HasAll(EAutoTileType.Left | EAutoTileType.Right | EAutoTileType.Bottom | EAutoTileType.BottomLeft | EAutoTileType.BottomRight) && cellType.HasNot(EAutoTileType.Top)) {
				sourceRect = new Rectangle(TileCell.TileWidth, TileCell.TileHeight, TileCell.TileWidth, TileCell.TileHeight);
				destRect = new Rectangle(drawTo.X * camera.TileWidth, drawTo.Y * camera.TileHeight, camera.TileWidth, camera.TileHeight);
				batch.Draw(texture, destRect, sourceRect, color);
				return;
			}
			#endregion
			#region Seiten unten mitte + diagonalen (Links + Rechts + Oben + ObenLinks + ObenRechts)
			if (cellType.HasAll(EAutoTileType.Left | EAutoTileType.Right | EAutoTileType.Top | EAutoTileType.TopLeft | EAutoTileType.TopRight) && cellType.HasNot(EAutoTileType.Bottom)) {
				sourceRect = new Rectangle(TileCell.TileWidth, texture.Height - TileCell.TileHeight, TileCell.TileWidth, TileCell.TileHeight);
				destRect = new Rectangle(drawTo.X * camera.TileWidth, drawTo.Y * camera.TileHeight, camera.TileWidth, camera.TileHeight);
				batch.Draw(texture, destRect, sourceRect, color);
				return;
			}
			#endregion

			#region Seite links mitte + diagonalen + linker Ausgang (Oben + Unten + Rechts + Links + ObenRechts + UntenRechts)
			if (cellType.HasAll(EAutoTileType.Top | EAutoTileType.Bottom | EAutoTileType.Right | EAutoTileType.Left | EAutoTileType.BottomRight | EAutoTileType.TopRight) && cellType.HasNot(EAutoTileType.TopLeft | EAutoTileType.BottomLeft)) {
				// linke Seite
				sourceRect = new Rectangle(TileCell.TileWidth * 2, 0, partWidthConst, TileCell.TileHeight);
				destRect = new Rectangle(drawTo.X * camera.TileWidth, drawTo.Y * camera.TileHeight, partWidth, camera.TileHeight);
				batch.Draw(texture, destRect, sourceRect, color);

				// rechte seite
				sourceRect = new Rectangle(partWidthConst, TileCell.TileHeight * 2, partWidthConst, TileCell.TileHeight);
				destRect = new Rectangle(drawTo.X * camera.TileWidth + partWidth, drawTo.Y * camera.TileHeight, partWidth, camera.TileHeight);
				batch.Draw(texture, destRect, sourceRect, color);
				return;
			}
			#endregion
			#region Seite rechts mitte + diagonalen + rechter Ausgang (Oben + Unten + Rechts + Links + ObenLinks + UntenLinks)
			if (cellType.HasAll(EAutoTileType.Top | EAutoTileType.Bottom | EAutoTileType.Right | EAutoTileType.Left | EAutoTileType.BottomLeft | EAutoTileType.TopLeft) && cellType.HasNot(EAutoTileType.TopRight | EAutoTileType.BottomRight)) {
				// linke Seite
				sourceRect = new Rectangle(partWidthConst, TileCell.TileHeight * 2, partWidthConst, TileCell.TileHeight);
				destRect = new Rectangle(drawTo.X * camera.TileWidth, drawTo.Y * camera.TileHeight, partWidth, camera.TileHeight);
				batch.Draw(texture, destRect, sourceRect, color);

				// rechte seite
				sourceRect = new Rectangle(TileCell.TileWidth * 2 + partWidthConst, 0, partWidthConst, TileCell.TileHeight);
				destRect = new Rectangle(drawTo.X * camera.TileWidth + partWidth, drawTo.Y * camera.TileHeight, partWidth, camera.TileHeight);
				batch.Draw(texture, destRect, sourceRect, color);
				return;
			}
			#endregion
			#region Seite oben mitte + diagonalen + oberer Ausgang (Links + Rechts + Unten + Oben + UntenLinks + UntenRechts)
			if (cellType.HasAll(EAutoTileType.Left | EAutoTileType.Right | EAutoTileType.Bottom | EAutoTileType.Top | EAutoTileType.BottomLeft | EAutoTileType.BottomRight) && cellType.HasNot(EAutoTileType.TopLeft | EAutoTileType.TopRight)) {
				// obere Kante
				sourceRect = new Rectangle(TileCell.TileWidth * 2, 0, TileCell.TileWidth, partheightConst);
				destRect = new Rectangle(drawTo.X * camera.TileWidth, drawTo.Y * camera.TileHeight, camera.TileWidth, partHeight);
				batch.Draw(texture, destRect, sourceRect, color);

				// untere Kante
				sourceRect = new Rectangle(TileCell.TileWidth, TileCell.TileHeight * 2, TileCell.TileWidth, partheightConst);
				destRect = new Rectangle(drawTo.X * camera.TileWidth, drawTo.Y * camera.TileHeight + partHeight, camera.TileWidth, partHeight);
				batch.Draw(texture, destRect, sourceRect, color);
				return;
			}
			#endregion
			#region Seite unten mitte + diagonalen + unterer Ausgang (Links + Rechts + Unten + Oben + ObenLinks + ObenRechts)
			if (cellType.HasAll(EAutoTileType.Left | EAutoTileType.Right | EAutoTileType.Bottom | EAutoTileType.Top | EAutoTileType.TopLeft | EAutoTileType.TopRight) && cellType.HasNot(EAutoTileType.BottomLeft | EAutoTileType.BottomRight)) {
				// obere Kante
				sourceRect = new Rectangle(TileCell.TileWidth, TileCell.TileHeight * 2, TileCell.TileWidth, partheightConst);
				destRect = new Rectangle(drawTo.X * camera.TileWidth, drawTo.Y * camera.TileHeight, camera.TileWidth, partHeight);
				batch.Draw(texture, destRect, sourceRect, color);

				// untere Kante
				sourceRect = new Rectangle(TileCell.TileWidth * 2, partheightConst, TileCell.TileWidth, partheightConst);
				destRect = new Rectangle(drawTo.X * camera.TileWidth, drawTo.Y * camera.TileHeight + partHeight, camera.TileWidth, partHeight);
				batch.Draw(texture, destRect, sourceRect, color);
				return;
			}
			#endregion

			#region Seite links mitte + Land unten rechts
			if (cellType.HasAll(EAutoTileType.Bottom | EAutoTileType.Top | EAutoTileType.Right | EAutoTileType.TopRight) && cellType.HasNot(EAutoTileType.BottomRight | EAutoTileType.Left)) {
				// links seite
				sourceRect = new Rectangle(0, TileCell.TileHeight * 2, partWidthConst, TileCell.TileHeight);
				destRect = new Rectangle(drawTo.X * camera.TileWidth, drawTo.Y * camera.TileHeight, partWidth, camera.TileHeight);
				batch.Draw(texture, destRect, sourceRect, color);

				// rechts oben
				sourceRect = new Rectangle(TileCell.TileWidth, TileCell.TileHeight * 2, partWidthConst, partheightConst);
				destRect = new Rectangle(drawTo.X * camera.TileWidth + partWidth, drawTo.Y * camera.TileHeight, partWidth, partHeight);
				batch.Draw(texture, destRect, sourceRect, color);

				// rechts unten
				sourceRect = new Rectangle(TileCell.TileWidth * 2 + partWidthConst, partheightConst, partWidthConst, partheightConst);
				destRect = new Rectangle(drawTo.X * camera.TileWidth + partWidth, drawTo.Y * camera.TileHeight + partHeight, partWidth, partHeight);
				batch.Draw(texture, destRect, sourceRect, color);
				return;
			}
			#endregion
			#region Seite links mitte + Land oben rechts
			if (cellType.HasAll(EAutoTileType.Bottom | EAutoTileType.Top | EAutoTileType.Right | EAutoTileType.BottomRight) && cellType.HasNot(EAutoTileType.TopRight | EAutoTileType.Left)) {
				// links seite
				sourceRect = new Rectangle(0, TileCell.TileHeight * 2, partWidthConst, TileCell.TileHeight);
				destRect = new Rectangle(drawTo.X * camera.TileWidth, drawTo.Y * camera.TileHeight, partWidth, camera.TileHeight);
				batch.Draw(texture, destRect, sourceRect, color);

				// rechts oben
				sourceRect = new Rectangle(TileCell.TileWidth * 2 + partWidthConst, 0, partWidthConst, partheightConst);
				destRect = new Rectangle(drawTo.X * camera.TileWidth + partWidth, drawTo.Y * camera.TileHeight, partWidth, partHeight);
				batch.Draw(texture, destRect, sourceRect, color);

				// rechts unten
				sourceRect = new Rectangle(TileCell.TileWidth, TileCell.TileHeight * 2, partWidthConst, partheightConst);
				destRect = new Rectangle(drawTo.X * camera.TileWidth + partWidth, drawTo.Y * camera.TileHeight + partHeight, partWidth, partHeight);
				batch.Draw(texture, destRect, sourceRect, color);
				return;
			}
			#endregion
			#region Seite oben mitte + Land unten rechts
			if (cellType.HasAll(EAutoTileType.Left | EAutoTileType.Right | EAutoTileType.Bottom | EAutoTileType.BottomLeft) && cellType.HasNot(EAutoTileType.Top | EAutoTileType.BottomRight)) {
				// obere Kante
				sourceRect = new Rectangle(TileCell.TileWidth, TileCell.TileHeight, TileCell.TileWidth, partheightConst);
				destRect = new Rectangle(drawTo.X * camera.TileWidth, drawTo.Y * camera.TileHeight, camera.TileWidth, partHeight);
				batch.Draw(texture, destRect, sourceRect, color);

				// unten links
				sourceRect = new Rectangle(TileCell.TileWidth, TileCell.TileHeight * 2, partWidthConst, partheightConst);
				destRect = new Rectangle(drawTo.X * camera.TileWidth, drawTo.Y * camera.TileHeight + partHeight, partWidth, partHeight);
				batch.Draw(texture, destRect, sourceRect, color);

				// unten rechts
				sourceRect = new Rectangle(TileCell.TileWidth * 2 + partWidthConst, partheightConst, partWidthConst, partheightConst);
				destRect = new Rectangle(drawTo.X * camera.TileWidth + partWidth, drawTo.Y * camera.TileHeight + partHeight, partWidth, partHeight);
				batch.Draw(texture, destRect, sourceRect, color);
				return;
			}
			#endregion
			#region Seite oben mitte + Land unten links
			if (cellType.HasAll(EAutoTileType.Left | EAutoTileType.Right | EAutoTileType.Bottom | EAutoTileType.BottomRight) && cellType.HasNot(EAutoTileType.Top | EAutoTileType.BottomLeft)) {
				// obere Kante
				sourceRect = new Rectangle(TileCell.TileWidth, TileCell.TileHeight, TileCell.TileWidth, partheightConst);
				destRect = new Rectangle(drawTo.X * camera.TileWidth, drawTo.Y * camera.TileHeight, camera.TileWidth, partHeight);
				batch.Draw(texture, destRect, sourceRect, color);

				// unten links
				sourceRect = new Rectangle(TileCell.TileWidth * 2, partheightConst, partWidthConst, partheightConst);
				destRect = new Rectangle(drawTo.X * camera.TileWidth, drawTo.Y * camera.TileHeight + partHeight, partWidth, partHeight);
				batch.Draw(texture, destRect, sourceRect, color);

				// unten rechts
				sourceRect = new Rectangle(TileCell.TileWidth, TileCell.TileHeight * 2, partWidthConst, partheightConst);
				destRect = new Rectangle(drawTo.X * camera.TileWidth + partWidth, drawTo.Y * camera.TileHeight + partHeight, partWidth, partHeight);
				batch.Draw(texture, destRect, sourceRect, color);
				return;
			}
			#endregion
			#region Seite unten mitte + Land oben rechts
			if (cellType.HasAll(EAutoTileType.Left | EAutoTileType.Right | EAutoTileType.Top | EAutoTileType.TopLeft) && cellType.HasNot(EAutoTileType.Bottom | EAutoTileType.TopRight)) {
				// untere Kante
				sourceRect = new Rectangle(TileCell.TileWidth, texture.Height - partheightConst, TileCell.TileWidth, partheightConst);
				destRect = new Rectangle(drawTo.X * camera.TileWidth, drawTo.Y * camera.TileHeight + partHeight, camera.TileWidth, partHeight);
				batch.Draw(texture, destRect, sourceRect, color);

				// oben links
				sourceRect = new Rectangle(TileCell.TileWidth, TileCell.TileHeight * 2, partWidthConst, partheightConst);
				destRect = new Rectangle(drawTo.X * camera.TileWidth, drawTo.Y * camera.TileHeight, partWidth, partHeight);
				batch.Draw(texture, destRect, sourceRect, color);

				// oben rechts
				sourceRect = new Rectangle(TileCell.TileWidth * 2 + partWidthConst, 0, partWidthConst, partheightConst);
				destRect = new Rectangle(drawTo.X * camera.TileWidth + partWidth, drawTo.Y * camera.TileHeight, partWidth, partHeight);
				batch.Draw(texture, destRect, sourceRect, color);
				return;
			}
			#endregion
			#region Seite unten mitte + Land oben links
			if (cellType.HasAll(EAutoTileType.Left | EAutoTileType.Right | EAutoTileType.Top | EAutoTileType.TopRight) && cellType.HasNot(EAutoTileType.Bottom | EAutoTileType.TopLeft)) {
				// untere Kante
				sourceRect = new Rectangle(TileCell.TileWidth, texture.Height - partheightConst, TileCell.TileWidth, partheightConst);
				destRect = new Rectangle(drawTo.X * camera.TileWidth, drawTo.Y * camera.TileHeight + partHeight, camera.TileWidth, partHeight);
				batch.Draw(texture, destRect, sourceRect, color);

				// oben links
				sourceRect = new Rectangle(TileCell.TileWidth * 2, 0, partWidthConst, partheightConst);
				destRect = new Rectangle(drawTo.X * camera.TileWidth, drawTo.Y * camera.TileHeight, partWidth, partHeight);
				batch.Draw(texture, destRect, sourceRect, color);

				// oben rechts
				sourceRect = new Rectangle(TileCell.TileWidth, TileCell.TileHeight * 2, partWidthConst, partheightConst);
				destRect = new Rectangle(drawTo.X * camera.TileWidth + partWidth, drawTo.Y * camera.TileHeight, partWidth, partHeight);
				batch.Draw(texture, destRect, sourceRect, color);
				return;
			}
			#endregion
			#region Seite rechts mitte + Land unten links
			if (cellType.HasAll(EAutoTileType.Bottom | EAutoTileType.Top | EAutoTileType.Left | EAutoTileType.TopLeft) && cellType.HasNot(EAutoTileType.BottomLeft | EAutoTileType.Right)) {
				// rechts seite
				sourceRect = new Rectangle(TileCell.TileWidth * 2 + partWidthConst, TileCell.TileHeight * 2, partWidthConst, TileCell.TileHeight);
				destRect = new Rectangle(drawTo.X * camera.TileWidth + partWidth, drawTo.Y * camera.TileHeight, partWidth, camera.TileHeight);
				batch.Draw(texture, destRect, sourceRect, color);

				// links oben
				sourceRect = new Rectangle(TileCell.TileWidth, TileCell.TileHeight * 2, partWidthConst, partheightConst);
				destRect = new Rectangle(drawTo.X * camera.TileWidth, drawTo.Y * camera.TileHeight, partWidth, partHeight);
				batch.Draw(texture, destRect, sourceRect, color);

				// links unten
				sourceRect = new Rectangle(TileCell.TileWidth * 2, partheightConst, partWidthConst, partheightConst);
				destRect = new Rectangle(drawTo.X * camera.TileWidth, drawTo.Y * camera.TileHeight + partHeight, partWidth, partHeight);
				batch.Draw(texture, destRect, sourceRect, color);
				return;
			}
			#endregion
			#region Seite rechts mitte + Land oben links
			if (cellType.HasAll(EAutoTileType.Bottom | EAutoTileType.Top | EAutoTileType.Left | EAutoTileType.BottomLeft) && cellType.HasNot(EAutoTileType.TopLeft | EAutoTileType.Right)) {
				// rechts seite
				sourceRect = new Rectangle(TileCell.TileWidth * 2 + partWidthConst, TileCell.TileHeight * 2, partWidthConst, TileCell.TileHeight);
				destRect = new Rectangle(drawTo.X * camera.TileWidth + partWidth, drawTo.Y * camera.TileHeight, partWidth, camera.TileHeight);
				batch.Draw(texture, destRect, sourceRect, color);

				// links oben
				sourceRect = new Rectangle(TileCell.TileWidth * 2, 0, partWidthConst, partheightConst);
				destRect = new Rectangle(drawTo.X * camera.TileWidth, drawTo.Y * camera.TileHeight, partWidth, partHeight);
				batch.Draw(texture, destRect, sourceRect, color);

				// links unten
				sourceRect = new Rectangle(TileCell.TileWidth, TileCell.TileHeight * 2, partWidthConst, partheightConst);
				destRect = new Rectangle(drawTo.X * camera.TileWidth, drawTo.Y * camera.TileHeight + partHeight, partWidth, partHeight);
				batch.Draw(texture, destRect, sourceRect, color);
				return;
			}
			#endregion

			#region Mitte (Alles)
			if (cellType.HasAll(EAutoTileType.Left | EAutoTileType.Right | EAutoTileType.Top | EAutoTileType.Bottom | EAutoTileType.BottomLeft | EAutoTileType.BottomRight | EAutoTileType.TopLeft | EAutoTileType.TopRight)) {
				sourceRect = new Rectangle(TileCell.TileWidth, TileCell.TileHeight * 2, TileCell.TileWidth, TileCell.TileHeight);
				destRect = new Rectangle(drawTo.X * camera.TileWidth, drawTo.Y * camera.TileHeight, camera.TileWidth, camera.TileHeight);
				batch.Draw(texture, destRect, sourceRect, color);
				return;
			}
			#endregion
			#region Mitte - Unten Links (Alles)
			if (cellType.HasAll(EAutoTileType.Left | EAutoTileType.Right | EAutoTileType.Top | EAutoTileType.Bottom | EAutoTileType.BottomRight | EAutoTileType.TopLeft | EAutoTileType.TopRight) && cellType.HasNot(EAutoTileType.BottomLeft)) {
				// obere Kante
				sourceRect = new Rectangle(TileCell.TileWidth, TileCell.TileHeight * 2, TileCell.TileWidth, partheightConst);
				destRect = new Rectangle(drawTo.X * camera.TileWidth, drawTo.Y * camera.TileHeight, camera.TileWidth, partHeight);
				batch.Draw(texture, destRect, sourceRect, color);

				// unten rechts
				sourceRect = new Rectangle(TileCell.TileWidth, TileCell.TileHeight * 2, partWidthConst, partheightConst);
				destRect = new Rectangle(drawTo.X * camera.TileWidth + partWidth, drawTo.Y * camera.TileHeight + partHeight, partWidth, partHeight);
				batch.Draw(texture, destRect, sourceRect, color);

				// unten links
				sourceRect = new Rectangle(TileCell.TileWidth * 2, partheightConst, partWidthConst, partheightConst);
				destRect = new Rectangle(drawTo.X * camera.TileWidth, drawTo.Y * camera.TileHeight + partHeight, partWidth, partHeight);
				batch.Draw(texture, destRect, sourceRect, color);
				return;
			}
			#endregion
			#region Mitte - Unten Rechts (Alles)
			if (cellType.HasAll(EAutoTileType.Left | EAutoTileType.Right | EAutoTileType.Top | EAutoTileType.Bottom | EAutoTileType.BottomLeft | EAutoTileType.TopLeft | EAutoTileType.TopRight) && cellType.HasNot(EAutoTileType.BottomRight)) {
				// obere Kante
				sourceRect = new Rectangle(TileCell.TileWidth, TileCell.TileHeight * 2, TileCell.TileWidth, partheightConst);
				destRect = new Rectangle(drawTo.X * camera.TileWidth, drawTo.Y * camera.TileHeight, camera.TileWidth, partHeight);
				batch.Draw(texture, destRect, sourceRect, color);

				// unten links
				sourceRect = new Rectangle(TileCell.TileWidth, TileCell.TileHeight * 2, partWidthConst, partheightConst);
				destRect = new Rectangle(drawTo.X * camera.TileWidth, drawTo.Y * camera.TileHeight + partHeight, partWidth, partHeight);
				batch.Draw(texture, destRect, sourceRect, color);

				// unten rechts
				sourceRect = new Rectangle(TileCell.TileWidth * 2 + partWidthConst, partheightConst, partWidthConst, partheightConst);
				destRect = new Rectangle(drawTo.X * camera.TileWidth + partWidth, drawTo.Y * camera.TileHeight + partHeight, partWidth, partHeight);
				batch.Draw(texture, destRect, sourceRect, color);
				return;
			}
			#endregion
			#region Mitte - Oben Links (Alles)
			if (cellType.HasAll(EAutoTileType.Left | EAutoTileType.Right | EAutoTileType.Top | EAutoTileType.Bottom | EAutoTileType.BottomRight | EAutoTileType.BottomLeft | EAutoTileType.TopRight) && cellType.HasNot(EAutoTileType.TopLeft)) {
				// untere Kante
				sourceRect = new Rectangle(TileCell.TileWidth, TileCell.TileHeight * 2, TileCell.TileWidth, partheightConst);
				destRect = new Rectangle(drawTo.X * camera.TileWidth, drawTo.Y * camera.TileHeight + partHeight, camera.TileWidth, partHeight);
				batch.Draw(texture, destRect, sourceRect, color);

				// oben rechts
				sourceRect = new Rectangle(TileCell.TileWidth, TileCell.TileHeight * 2, partWidthConst, partheightConst);
				destRect = new Rectangle(drawTo.X * camera.TileWidth + partWidth, drawTo.Y * camera.TileHeight, partWidth, partHeight);
				batch.Draw(texture, destRect, sourceRect, color);

				// oben links
				sourceRect = new Rectangle(TileCell.TileWidth * 2, 0, partWidthConst, partheightConst);
				destRect = new Rectangle(drawTo.X * camera.TileWidth, drawTo.Y * camera.TileHeight, partWidth, partHeight);
				batch.Draw(texture, destRect, sourceRect, color);
				return;
			}
			#endregion
			#region Mitte - Oben Rechts (Alles)
			if (cellType.HasAll(EAutoTileType.Left | EAutoTileType.Right | EAutoTileType.Top | EAutoTileType.Bottom | EAutoTileType.BottomRight | EAutoTileType.BottomLeft | EAutoTileType.TopLeft) && cellType.HasNot(EAutoTileType.TopRight)) {
				// untere Kante
				sourceRect = new Rectangle(TileCell.TileWidth, TileCell.TileHeight * 2, TileCell.TileWidth, partheightConst);
				destRect = new Rectangle(drawTo.X * camera.TileWidth, drawTo.Y * camera.TileHeight + partHeight, camera.TileWidth, partHeight);
				batch.Draw(texture, destRect, sourceRect, color);

				// oben links
				sourceRect = new Rectangle(TileCell.TileWidth, TileCell.TileHeight * 2, partWidthConst, partheightConst);
				destRect = new Rectangle(drawTo.X * camera.TileWidth, drawTo.Y * camera.TileHeight, partWidth, partHeight);
				batch.Draw(texture, destRect, sourceRect, color);

				// oben rechts
				sourceRect = new Rectangle(TileCell.TileWidth * 2 + partWidthConst, 0, partWidthConst, partheightConst);
				destRect = new Rectangle(drawTo.X * camera.TileWidth + partWidth, drawTo.Y * camera.TileHeight, partWidth, partHeight);
				batch.Draw(texture, destRect, sourceRect, color);
				return;
			}
			#endregion

			#region Mitte - Unten Links + Oben Rechts
			if (cellType.HasAll(EAutoTileType.Left | EAutoTileType.Right | EAutoTileType.Top | EAutoTileType.Bottom | EAutoTileType.BottomRight | EAutoTileType.TopLeft) && cellType.HasNot(EAutoTileType.TopRight | EAutoTileType.BottomLeft)) {
				// oben links
				sourceRect = new Rectangle(TileCell.TileWidth, TileCell.TileHeight * 2, partWidthConst, partheightConst);
				destRect = new Rectangle(drawTo.X * camera.TileWidth, drawTo.Y * camera.TileHeight, partWidth, partHeight);
				batch.Draw(texture, destRect, sourceRect, color);

				// unten rechts
				sourceRect = new Rectangle(TileCell.TileWidth, TileCell.TileHeight * 2, partWidthConst, partheightConst);
				destRect = new Rectangle(drawTo.X * camera.TileWidth + partWidth, drawTo.Y * camera.TileHeight + partHeight, partWidth, partHeight);
				batch.Draw(texture, destRect, sourceRect, color);

				// oben rechts
				sourceRect = new Rectangle(TileCell.TileWidth * 2 + partWidthConst, 0, partWidthConst, partheightConst);
				destRect = new Rectangle(drawTo.X * camera.TileWidth + partWidth, drawTo.Y * camera.TileHeight, partWidth, partHeight);
				batch.Draw(texture, destRect, sourceRect, color);

				// unten links
				sourceRect = new Rectangle(TileCell.TileWidth * 2, partheightConst, partWidthConst, partheightConst);
				destRect = new Rectangle(drawTo.X * camera.TileWidth, drawTo.Y * camera.TileHeight + partHeight, partWidth, partHeight);
				batch.Draw(texture, destRect, sourceRect, color);
				return;
			}
			#endregion
			#region Mitte - Unten Rechts + Oben Links
			if (cellType.HasAll(EAutoTileType.Left | EAutoTileType.Right | EAutoTileType.Top | EAutoTileType.Bottom | EAutoTileType.TopRight | EAutoTileType.BottomLeft) && cellType.HasNot(EAutoTileType.BottomRight | EAutoTileType.TopLeft)) {
				// oben Rechts
				sourceRect = new Rectangle(TileCell.TileWidth, TileCell.TileHeight * 2, partWidthConst, partheightConst);
				destRect = new Rectangle(drawTo.X * camera.TileWidth + partWidth, drawTo.Y * camera.TileHeight, partWidth, partHeight);
				batch.Draw(texture, destRect, sourceRect, color);

				// unten links
				sourceRect = new Rectangle(TileCell.TileWidth, TileCell.TileHeight * 2, partWidthConst, partheightConst);
				destRect = new Rectangle(drawTo.X * camera.TileWidth, drawTo.Y * camera.TileHeight + partHeight, partWidth, partHeight);
				batch.Draw(texture, destRect, sourceRect, color);

				// oben links
				sourceRect = new Rectangle(TileCell.TileWidth * 2, 0, partWidthConst, partheightConst);
				destRect = new Rectangle(drawTo.X * camera.TileWidth, drawTo.Y * camera.TileHeight, partWidth, partHeight);
				batch.Draw(texture, destRect, sourceRect, color);

				// unten rechts
				sourceRect = new Rectangle(TileCell.TileWidth * 2 + partWidthConst, partheightConst, partWidthConst, partheightConst);
				destRect = new Rectangle(drawTo.X * camera.TileWidth + partWidth, drawTo.Y * camera.TileHeight + partHeight, partWidth, partHeight);
				batch.Draw(texture, destRect, sourceRect, color);
			}
			#endregion

		}
예제 #16
0
		public bool SetAutoCell(Point2D point, TileCell cell) {
			return SetAutoCell(point.X, point.Y, cell);
		}
예제 #17
0
		public bool SetAutoCell(int x, int y, TileCell cell) {
			if (IsValidPoint(x, y) == false) {
				return false;
			}

			mLayoutMap[x][y] = (TileCell)cell.Clone();
			mLayoutMap[x][y].TextureSource.IsAutotile = true;
			// Make sure we never loose the spot information!
			mLayoutMap[x][y].X = x;
			mLayoutMap[x][y].Y = y;
			return true;
		}
예제 #18
0
		private void SetCells(Point2D toPointStart, Point2D toPointEnd, TileCell toCell) {
			var undos = new List<UndoAction>();
			Point2D p;
			TileCell cellBefore;
			var baseCell = GetCell(mCursorCell);
			var sameTexture = MenuSettingsFillSameTexture.Checked;
			for (var x = toPointStart.X; x < toPointEnd.X; x++) {
				for (var y = toPointStart.Y; y < toPointEnd.Y; y++) {
					p = new Point2D(x, y);
					cellBefore = GetCell(p);
					if (sameTexture && cellBefore.TextureSource.IsEqualTo(baseCell.TextureSource) == false) {
						continue;
					}
					if (SetCell(p, toCell, true) == false) {
						break;
					}

					undos.Add(new UndoAction(mCurrentLayer, toCell, cellBefore, p));
				}
			}
			UndoAdd(undos);
		}
예제 #19
0
		public TileCell(TileCell oldCell) :
			this(new Point2D(oldCell.X, oldCell.Y), oldCell.TextureSource, oldCell.Alpha, oldCell.Rotation) {
			AutoTextureType = oldCell.AutoTextureType;
			FlipEffect = oldCell.FlipEffect;
		}
예제 #20
0
		private bool SetCellGroup(Point2D toPoint, bool groupDraw, List<UndoAction> RefUndos = null) {
			if (RefUndos == null) {
				RefUndos = new List<UndoAction>();
			}

			TileCell cell, cellBefore;
			int texX, texY;
			var privUndos = new List<UndoAction>();
			Point2D p;
			var mirrorH = (mTempEffect & SpriteEffects.FlipHorizontally) == SpriteEffects.FlipHorizontally;
			var mirrorV = (mTempEffect & SpriteEffects.FlipVertically) == SpriteEffects.FlipVertically;
			var mirrorSubX = (mirrorH ? mTextureRect.Width - 1 : 0);
			var mirrorSubY = (mirrorV ? mTextureRect.Height - 1 : 0);

			for (var x = 0; x < mTextureRect.Width; x++) {
				if ((toPoint.X + x) >= mTileMap.Layers[mCurrentLayer].Width) {
					break;
				}
				for (var y = 0; y < mTextureRect.Height; y++) {
					if ((toPoint.Y + y) >= mTileMap.Layers[mCurrentLayer].Height) {
						break;
					}

					p = new Point2D(toPoint.X + x, toPoint.Y + y);

					texX = (mirrorSubX - x) * Constants.TileWidth;
					if (texX < 0) // no mirror, 0 - X = -Y...
					{
						texX *= -1;
					}
					texX += mTextureRect.X * Constants.TileWidth;

					texY = (mirrorSubY - y) * Constants.TileHeight;
					if (texY < 0) {
						texY *= -1;
					}
					texY += mTextureRect.Y * Constants.TileHeight;

					cell = new TileCell(p, new Rectangle(texX, texY, Constants.TileWidth, Constants.TileHeight), FileLists.Instance.Tilesets[mLastTilesetIndex[mCurrentLayer]].Filename, 1f, 0f);
					cell.FlipEffect = mTempEffect;
					cellBefore = GetCell(p);
					if (SetCell(p, cell, true)) {
						if (groupDraw) {
							RefUndos.Add(new UndoAction(mCurrentLayer, cell, cellBefore, p));
						} else {
							privUndos.Add(new UndoAction(mCurrentLayer, cell, cellBefore, p));
						}
					}
				}
			}

			if (groupDraw == false) {
				UndoAdd(privUndos);
			}
			privUndos.Clear();

			return true;
		}
예제 #21
0
		public bool IsEqualTo(TileCell cell) {
			if (X != cell.X || Y != cell.Y) {
				return false;
			}
			if (Alpha.Equals(cell.Alpha) == false)
				return false;
			if (Rotation.Equals(cell.Rotation) == false)
				return false;
			if (AutoTextureType != cell.AutoTextureType)
				return false;
			if (FlipEffect != cell.FlipEffect)
				return false;

			return TextureSource.IsEqualTo(cell.TextureSource);
		}
예제 #22
0
		private void StartCopy(bool Cut, bool DeepCut) {
			if (mTileMap == null || mTileMap.Width == 0 || mTileMap.Height == 0 || mCurrentLayer == -1) {
				return;
			}
			if (mMarkerRectangle == Rectangle.Empty) {
				return;
			}

			var undoItems = new List<UndoAction>();
			Point2D startPoint = Point2D.Zero, endPoint = Point2D.Zero;
			startPoint.X = mMarkerRectangle.X;
			startPoint.Y = mMarkerRectangle.Y;
			endPoint = new Point2D(startPoint.X + mMarkerRectangle.Width, startPoint.Y + mMarkerRectangle.Height);

			mCopyLayout = new TileCell[mTileMap.Layers.Count][,];
			mCopyLayer = mCurrentLayer;
			for (var layer = 0; layer < mTileMap.Layers.Count; layer++) {
				mCopyLayout[layer] = new TileCell[endPoint.X - startPoint.X, endPoint.Y - startPoint.Y];
				for (var mapY = startPoint.Y; mapY < endPoint.Y; mapY++) {
					for (var mapX = startPoint.X; mapX < endPoint.X; mapX++) {
						mCopyLayout[layer][mapX - startPoint.X, mapY - startPoint.Y] = mTileMap.Layers[layer].GetCell(mapX, mapY);
						if (Cut && (DeepCut || layer == mCurrentLayer)) {
							undoItems.Add(new UndoAction(layer, TileCell.Empty, mCopyLayout[layer][mapX - startPoint.X, mapY - startPoint.Y], new Point2D(mapX, mapY)));
							mTileMap.Layers[layer].SetCell(mapX, mapY, TileCell.Empty);
						}
					}
				}
			}

			UndoAdd(undoItems);
			undoItems.Clear();
		}
예제 #23
0
		public TileLayer(TileLayer existingLayer, int newWidth, int newHeight) {
			mAlpha = existingLayer.Alpha;
			mIsBackground = existingLayer.IsBackground;
			mName = existingLayer.Name;
			mLayoutMap = new TileCell[newWidth][];

			for (int x = 0; x < newWidth; x++) {
				mLayoutMap[x] = new TileCell[newHeight];
				for (int y = 0; y < newHeight; y++) {
					if (existingLayer.LayoutMap == null || x >= existingLayer.LayoutMap.Length || y >= existingLayer.LayoutMap[x].Length) {
						mLayoutMap[x][y] = TileCell.Empty;
						mLayoutMap[x][y].X = x;
						mLayoutMap[x][y].Y = y;
					} else {
						mLayoutMap[x][y] = existingLayer.LayoutMap[x][y].Clone() as TileCell;
					}
				}
			}

		}