public void NotifyWallTypeChanged(IWall wall) { // Update wall UpdateSprite(wall); // Update neighbors UpdateSprite(wall.GetNeighbor(0, 0, 0)); UpdateSprite(wall.GetNeighbor(0, 0, 1)); UpdateSprite(wall.GetNeighbor(0, 1, 0)); UpdateSprite(wall.GetNeighbor(0, 1, 1)); UpdateSprite(wall.GetNeighbor(0, -1, 1)); UpdateSprite(wall.GetNeighbor(1, 0, 0)); UpdateSprite(wall.GetNeighbor(1, 0, 1)); UpdateSprite(wall.GetNeighbor(1, -1, 1)); UpdateSprite(wall.GetNeighbor(-1, 0, 0)); UpdateSprite(wall.GetNeighbor(-1, 1, 0)); }
private bool HasNeighborShortcut(IWall wall, Vector3Int coords) { return(wall.GetNeighbor(coords.x, coords.y, coords.z).Type != WallIndex.Empty); }
public InmediateWallNeighbors(IWall sourceWall, Orientation orientation) { int rotatedZ = WallTransformer.RotateCoord(new Vector3Int(0, 0, sourceWall.Z)).z; if (orientation == Orientation.North) { if (rotatedZ == 0) { Top = sourceWall.GetNeighbor(-1, 0, 0); TopLeft = sourceWall.GetNeighbor(0, -1, 1); TopRight = sourceWall.GetNeighbor(0, 0, 1); Bottom = sourceWall.GetNeighbor(1, 0, 0); BottomLeft = sourceWall.GetNeighbor(1, -1, 1); BottomRight = sourceWall.GetNeighbor(1, 0, 1); } else { Top = sourceWall.GetNeighbor(0, -1, 1); TopLeft = sourceWall.GetNeighbor(0, 0, 0); TopRight = sourceWall.GetNeighbor(-1, 0, 0); Bottom = sourceWall.GetNeighbor(0, 1, 1); BottomLeft = sourceWall.GetNeighbor(0, 1, 0); BottomRight = sourceWall.GetNeighbor(-1, 1, 0); } } else if (orientation == Orientation.West) { if (rotatedZ == 0) { Top = sourceWall.GetNeighbor(0, -1, 1); TopLeft = sourceWall.GetNeighbor(0, 0, 0); TopRight = sourceWall.GetNeighbor(-1, 0, 0); Bottom = sourceWall.GetNeighbor(0, 1, 1); BottomLeft = sourceWall.GetNeighbor(0, 1, 0); BottomRight = sourceWall.GetNeighbor(-1, 1, 0); } else { Top = sourceWall.GetNeighbor(1, 0, 0); TopLeft = sourceWall.GetNeighbor(1, 0, 1); TopRight = sourceWall.GetNeighbor(1, -1, 1); Bottom = sourceWall.GetNeighbor(-1, 0, 0); BottomLeft = sourceWall.GetNeighbor(0, 0, 1); BottomRight = sourceWall.GetNeighbor(0, -1, 1); } } else if (orientation == Orientation.South) { if (rotatedZ == 0) { Top = sourceWall.GetNeighbor(1, 0, 0); TopLeft = sourceWall.GetNeighbor(1, 0, 1); TopRight = sourceWall.GetNeighbor(1, -1, 1); Bottom = sourceWall.GetNeighbor(-1, 0, 0); BottomLeft = sourceWall.GetNeighbor(0, 0, 1); BottomRight = sourceWall.GetNeighbor(0, -1, 1); } else { Top = sourceWall.GetNeighbor(0, 1, 1); TopLeft = sourceWall.GetNeighbor(-1, 1, 0); TopRight = sourceWall.GetNeighbor(0, 1, 0); Bottom = sourceWall.GetNeighbor(0, -1, 1); BottomLeft = sourceWall.GetNeighbor(-1, 0, 0); BottomRight = sourceWall.GetNeighbor(0, 0, 0); } } else { if (rotatedZ == 0) { Top = sourceWall.GetNeighbor(0, 1, 1); TopLeft = sourceWall.GetNeighbor(-1, 1, 0); TopRight = sourceWall.GetNeighbor(0, 1, 0); Bottom = sourceWall.GetNeighbor(0, -1, 1); BottomLeft = sourceWall.GetNeighbor(-1, 0, 0); BottomRight = sourceWall.GetNeighbor(0, 0, 0); } else { Top = sourceWall.GetNeighbor(-1, 0, 0); TopLeft = sourceWall.GetNeighbor(0, -1, 1); TopRight = sourceWall.GetNeighbor(0, 0, 1); Bottom = sourceWall.GetNeighbor(1, 0, 0); BottomLeft = sourceWall.GetNeighbor(1, -1, 1); BottomRight = sourceWall.GetNeighbor(1, 0, 1); } } }