static private void FindFall(TilePosition dir, TileManager tileManager, Tile tile, TilePosition pos, ref TilePosition nearDirection, ref int nearDistance) { TilePosition posNear = pos; for (int d = 1; d < nearDistance; d++) { posNear += dir; if (tileManager.IsValidTile(posNear) && (tileManager.GetTileType(posNear) == TileDefinition.EMPTY_TILE_TYPE || tileManager.GetTileType(posNear) == tile.tileType && tileManager.GetTileExtraData(posNear) != 0)) { TilePosition posNearBelow = posNear + new TilePosition(0, -1, 0); if (tileManager.IsValidTile(posNearBelow) && (tileManager.GetTileType(posNearBelow) == TileDefinition.EMPTY_TILE_TYPE || tileManager.GetTileType(posNearBelow) == tile.tileType)) { nearDirection = dir; nearDistance = d; break; } } else break; } }
static private int GetLowerLevel(TilePosition dir, TileManager tileManager, Tile tile, TilePosition pos, int minLevel) { TilePosition posNear = pos + dir; if (tileManager.IsValidTile(posNear) && tileManager.GetTileType(posNear) == tile.tileType) { int levelNear = tileManager.GetTileExtraData(posNear); if (levelNear < minLevel) minLevel = levelNear; } return minLevel; }