public static CellSlot Rotate(this CellSlot slot, int rotation) { CellSlot result = CellSlot.None; if (slot.HasFlag(CellSlot.Floor)) { result |= CellSlot.Floor; } if (slot.HasFlag(CellSlot.Ceiling)) { result |= CellSlot.Ceiling; } if (slot.HasFlag(CellSlot.Wall0)) { result |= RotateWall(CellSlot.Wall0, rotation); } if (slot.HasFlag(CellSlot.Wall1)) { result |= RotateWall(CellSlot.Wall1, rotation); } if (slot.HasFlag(CellSlot.Wall2)) { result |= RotateWall(CellSlot.Wall2, rotation); } if (slot.HasFlag(CellSlot.Wall3)) { result |= RotateWall(CellSlot.Wall3, rotation); } return(result); }
private void ClearNeighbourWallSlots(int x, int z, CellSlot slot) { for (int i = 0; i < 4; i++) { var wallSlot = CellSlotExtensions.ToWallSlot(i); if (slot.HasFlag(wallSlot)) { var oppositeWallSlot = CellSlotExtensions.RotateWall(wallSlot, 2); var(dx, dz) = wallSlot.ToDirectionVector(); ClearCellSlot(x + dx, z + dz, oppositeWallSlot); } } }
public void PutDecorator(CellSlot slot, GameObject prefab, int rotation) { var deco = prefab == null ? null : new CellDecorator { prefab = prefab, rotation = rotation }; if (slot.HasFlag(CellSlot.Floor)) { DisposeDeco(Floor); Floor = deco; } if (slot.HasFlag(CellSlot.Ceiling)) { DisposeDeco(Ceiling); Ceiling = deco; } if (slot.HasFlag(CellSlot.Wall0)) { DisposeDeco(Wall0); Wall0 = deco; } if (slot.HasFlag(CellSlot.Wall1)) { DisposeDeco(Wall1); Wall1 = deco; } if (slot.HasFlag(CellSlot.Wall2)) { DisposeDeco(Wall2); Wall2 = deco; } if (slot.HasFlag(CellSlot.Wall3)) { DisposeDeco(Wall3); Wall3 = deco; } UpdateView(); }