private static PortTownIndividualPacket createNewPortTownAtLocation(SimplifiedLayoutReturnPacket simplifiedLayout, UpscaledLayoutReturnPacket upscaledLayout, byte roomX, byte roomY, float roomWidthHeight, int numOfVertsPerEdge, System.Random random_forThread) { PortTownIndividualPacket portTownIndividual = new PortTownIndividualPacket(); portTownIndividual.setPortTownPierCoords_simple(roomX, roomY); Vector2 waterPosition = new Vector2((roomX + 0.5f) * roomWidthHeight, (roomY + 0.5f) * -roomWidthHeight); Vector2 landPosition = findPortTownPierLandPoint(simplifiedLayout.getSimplifiedRoomArray()[roomX, roomY], waterPosition, roomWidthHeight, random_forThread); portTownIndividual.setPortTownYRotation(Vector2.SignedAngle(waterPosition - landPosition, Vector2.up)); Vector2 stepAmount = (landPosition - waterPosition).normalized * Constants.shipMoveSpeed; do { waterPosition += stepAmount; } while (BoolArrayManager.checkForConflict_V2_noDoors(upscaledLayout.getBoolArray(), waterPosition)); stepAmount = stepAmount / Constants.shipMoveSpeed * Constants.portTownDistanceFromLand; waterPosition -= stepAmount; portTownIndividual.setPortTownPierCoords_upscaled(waterPosition.x, waterPosition.y); addHousesAroundPier(portTownIndividual, upscaledLayout.getLandVertexHeights(), random_forThread); return(portTownIndividual); }
// public TerrainBuilderReturnPacket(SimplifiedLayoutReturnPacket simplePacket, UpscaledLayoutReturnPacket upscaledPacket, Mesh[,] terrainMeshes) public TerrainBuilderReturnPacket(SimplifiedLayoutReturnPacket simplePacket, UpscaledLayoutReturnPacket upscaledPacket, TerrainMeshDataPacket[,] meshData, PortTownReturnPacket portTownPacket) { // this.terrainMeshes = terrainMeshes; boolArray = upscaledPacket.getBoolArray(); boolArray_noNoise = upscaledPacket.getBoolArray_noNoise(); this.meshData = meshData; this.simplePacket = simplePacket; this.portTownPacket = portTownPacket; numOfKeys = 0; for (int index = 0; index < 6; index++) { if (simplePacket.getHasKey()[index]) { numOfKeys++; } } }