public VGWorld(int mWidth, int mHeight, int mValue) { Debug.Assert(mWidth > 0); Debug.Assert(mHeight > 0); Width = mWidth; Height = mHeight; Tiles = new VGTile[Width,Height]; for (int iY = 0; iY < Height; iY++) for (int iX = 0; iX < Width; iX++) Tiles[iX, iY] = new VGTile(iX, iY, mValue); WorldArea = new VGArea(this, 0, 0, mWidth, mHeight); }
public VGArea(VGWorld mWorld, int mXStart, int mYStart, int mXEnd, int mYEnd) { Debug.Assert(XStart >= 0 && XStart <= XEnd && XEnd < mWorld.Width); Debug.Assert(YStart >= 0 && YStart <= YEnd && YEnd < mWorld.Height); World = mWorld; XStart = mXStart; YStart = mYStart; XEnd = mXEnd; YEnd = mYEnd; Tiles = new VGTile[Width,Height]; for (int iY = 0; iY < Height; iY++) for (int iX = 0; iX < Width; iX++) Tiles[iX, iY] = World.Tiles[iX + XStart, iY + YStart]; }
public VGWorld(int mWidth, int mHeight, int mValue) { Debug.Assert(mWidth > 0); Debug.Assert(mHeight > 0); Width = mWidth; Height = mHeight; Tiles = new VGTile[Width, Height]; for (int iY = 0; iY < Height; iY++) { for (int iX = 0; iX < Width; iX++) { Tiles[iX, iY] = new VGTile(iX, iY, mValue); } } WorldArea = new VGArea(this, 0, 0, mWidth, mHeight); }
public VGArea(VGWorld mWorld, int mXStart, int mYStart, int mXEnd, int mYEnd) { Debug.Assert(XStart >= 0 && XStart <= XEnd && XEnd < mWorld.Width); Debug.Assert(YStart >= 0 && YStart <= YEnd && YEnd < mWorld.Height); World = mWorld; XStart = mXStart; YStart = mYStart; XEnd = mXEnd; YEnd = mYEnd; Tiles = new VGTile[Width, Height]; for (int iY = 0; iY < Height; iY++) { for (int iX = 0; iX < Width; iX++) { Tiles[iX, iY] = World.Tiles[iX + XStart, iY + YStart]; } } }