public static void SelfFrame8Way(int i, int j, Tile centerTile, bool resetFrame) { if (!centerTile.active()) { return; } BlockStyle blockStyle = FindBlockStyle(centerTile); int num = 0; BlockStyle blockStyle2 = default(BlockStyle); if (blockStyle.top) { Tile tileSafely = GetTileSafely(i, j - 1); if (tileSafely.active() && WillItBlend(centerTile.type, tileSafely.type)) { blockStyle2 = FindBlockStyle(tileSafely); if (blockStyle2.bottom) { num |= 1; } else { blockStyle2.Clear(); } } } BlockStyle blockStyle3 = default(BlockStyle); if (blockStyle.left) { Tile tileSafely2 = GetTileSafely(i - 1, j); if (tileSafely2.active() && WillItBlend(centerTile.type, tileSafely2.type)) { blockStyle3 = FindBlockStyle(tileSafely2); if (blockStyle3.right) { num |= 2; } else { blockStyle3.Clear(); } } } BlockStyle blockStyle4 = default(BlockStyle); if (blockStyle.right) { Tile tileSafely3 = GetTileSafely(i + 1, j); if (tileSafely3.active() && WillItBlend(centerTile.type, tileSafely3.type)) { blockStyle4 = FindBlockStyle(tileSafely3); if (blockStyle4.left) { num |= 4; } else { blockStyle4.Clear(); } } } BlockStyle blockStyle5 = default(BlockStyle); if (blockStyle.bottom) { Tile tileSafely4 = GetTileSafely(i, j + 1); if (tileSafely4.active() && WillItBlend(centerTile.type, tileSafely4.type)) { blockStyle5 = FindBlockStyle(tileSafely4); if (blockStyle5.top) { num |= 8; } else { blockStyle5.Clear(); } } } if (blockStyle2.left && blockStyle3.top) { Tile tileSafely5 = GetTileSafely(i - 1, j - 1); if (tileSafely5.active() && WillItBlend(centerTile.type, tileSafely5.type)) { BlockStyle blockStyle6 = FindBlockStyle(tileSafely5); if (blockStyle6.right && blockStyle6.bottom) { num |= 0x10; } } } if (blockStyle2.right && blockStyle4.top) { Tile tileSafely6 = GetTileSafely(i + 1, j - 1); if (tileSafely6.active() && WillItBlend(centerTile.type, tileSafely6.type)) { BlockStyle blockStyle7 = FindBlockStyle(tileSafely6); if (blockStyle7.left && blockStyle7.bottom) { num |= 0x20; } } } if (blockStyle5.left && blockStyle3.bottom) { Tile tileSafely7 = GetTileSafely(i - 1, j + 1); if (tileSafely7.active() && WillItBlend(centerTile.type, tileSafely7.type)) { BlockStyle blockStyle8 = FindBlockStyle(tileSafely7); if (blockStyle8.right && blockStyle8.top) { num |= 0x40; } } } if (blockStyle5.right && blockStyle4.bottom) { Tile tileSafely8 = GetTileSafely(i + 1, j + 1); if (tileSafely8.active() && WillItBlend(centerTile.type, tileSafely8.type)) { BlockStyle blockStyle9 = FindBlockStyle(tileSafely8); if (blockStyle9.left && blockStyle9.top) { num |= 0x80; } } } if (resetFrame) { centerTile.frameNumber((byte)WorldGen.genRand.Next(0, 3)); } Point16 point = selfFrame8WayLookup[num][centerTile.frameNumber()]; centerTile.frameX = point.X; centerTile.frameY = point.Y; }
/// <summary> /// Block定義をクリア /// </summary> public void ClearBlockStyle() { blockStyle.Clear(); }