internal override RoomDefinition PlaceDoor(RoomDefinition room, int wallPosition, ModuleTypes doorModule, bool addGround) { switch (wallPosition) { case 1: room.SetModulePosition(1, 2, ModuleTypes.PlatformLarge); room.SetModulePosition(0, 2, doorModule); RemoveFromList(moduleSpaces, PositionToNumber(0, 2 - 1, innerSize)); break; case 3: room.SetModulePosition(2, 1, ModuleTypes.PlatformLarge); room.SetModulePosition(2, 0, doorModule); RemoveFromList(moduleSpaces, PositionToNumber(2 - 1, 0, innerSize)); break; case 2: room.SetModulePosition(2, size - 2, ModuleTypes.PlatformLarge); room.SetModulePosition(2, size - 1, doorModule); RemoveFromList(moduleSpaces, PositionToNumber(2 - 1, size - 3, innerSize)); break; case 0: room.SetModulePosition(size - 2, 2, ModuleTypes.PlatformLarge); room.SetModulePosition(size - 1, 2, doorModule); RemoveFromList(moduleSpaces, PositionToNumber(size - 3, 2 - 1, innerSize)); break; } return(room); }
public static RoomDefinition MakeOuterModuleGrid(RoomDefinition room, int totalSize) { for (var i = 0; i < totalSize; i++) { for (var j = 0; j < totalSize; j++) { // Create corner. if (i == 0 && j == 0 || i == 0 && j == totalSize - 1 || i == totalSize - 1 && j == 0 || i == totalSize - 1 && j == totalSize - 1) { room.SetModulePosition(i, j, ModuleTypes.WallCorner); } // Check for edge and create wall. else if ((i == 0 || i == totalSize - 1 || j == 0 || j == totalSize - 1) && (int)room.GetModuleType(i, j) == 0) { room.SetModulePosition(i, j, ModuleTypes.WallWindow); } } } return(room); }
internal virtual RoomDefinition PlaceDoor(RoomDefinition room, int wallPosition, ModuleTypes doorModule, bool addGround) { var doorPosition = 2; if (room.size == 7) { doorPosition = 3; } switch (wallPosition) { case 1: if (addGround) { room.SetModulePosition(1, doorPosition, ModuleTypes.PlatformLarge); } for (int i = 1; i < size - 1; i++) { room.SetModulePosition(0, i, ModuleTypes.Wall); } room.SetModulePosition(0, doorPosition, doorModule); break; case 3: if (addGround) { room.SetModulePosition(doorPosition, 1, ModuleTypes.PlatformLarge); } for (int i = 1; i < size - 1; i++) { room.SetModulePosition(i, 0, ModuleTypes.Wall); } room.SetModulePosition(doorPosition, 0, doorModule); break; case 2: if (addGround) { room.SetModulePosition(doorPosition, size - 2, ModuleTypes.PlatformLarge); } for (int i = 1; i < size - 1; i++) { room.SetModulePosition(i, size - 1, ModuleTypes.Wall); } room.SetModulePosition(doorPosition, size - 1, doorModule); break; case 0: if (addGround) { room.SetModulePosition(size - 2, doorPosition, ModuleTypes.PlatformLarge); } for (int i = 1; i < size - 1; i++) { room.SetModulePosition(size - 1, i, ModuleTypes.Wall); } room.SetModulePosition(size - 1, doorPosition, doorModule); break; } return(room); }