示例#1
0
        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);
        }
示例#2
0
        public static TerrainBuilderReturnPacket generateTerrain_shipSelectionVer(float roomWidthHeight, int numOfVertsPerEdge)
        {
            System.Random random_forThread = new System.Random();

            SimplifiedLayoutReturnPacket simplifiedLayout = SimplifiedLayoutTemplates.generateLayout_ShipSelectionScreen();

            UpscaledLayoutReturnPacket upscaledLayout = UpscaledLayoutBuilder.upscaleLayout_Title(simplifiedLayout, roomWidthHeight, numOfVertsPerEdge, random_forThread);

            // Mesh[,] returnMeshes = sliceHeightArrayIntoMultipleMeshes(upscaledLayout.getLandVertexHeights(), roomWidthHeight, numOfVertsPerEdge);
            TerrainMeshDataPacket[,] meshData = sliceHeightArrayIntoMultipleMeshes_2(upscaledLayout.getLandVertexHeights(), roomWidthHeight, numOfVertsPerEdge);

            // return new TerrainBuilderReturnPacket(simplifiedLayout, upscaledLayout, returnMeshes);
            return(new TerrainBuilderReturnPacket(simplifiedLayout, upscaledLayout, meshData, null));
        }
示例#3
0
        public static TerrainBuilderReturnPacket generateTerrain_DemoVer(float roomWidthHeight, int numOfVertsPerEdge)
        {
            // System.Random random_forThread = new System.Random();

            SimplifiedLayoutReturnPacket simplifiedLayout = SimplifiedLayoutTemplates.generateLayout_Demo();

            UpscaledLayoutReturnPacket upscaledLayout = UpscaledLayoutBuilder.upscaleLayout_Demo(simplifiedLayout, roomWidthHeight, numOfVertsPerEdge);

            // Mesh[,] returnMeshes = sliceHeightArrayIntoMultipleMeshes(upscaledLayout.getLandVertexHeights(), roomWidthHeight, numOfVertsPerEdge);
            TerrainMeshDataPacket[,] meshData = sliceHeightArrayIntoMultipleMeshes_2(upscaledLayout.getLandVertexHeights(), roomWidthHeight, numOfVertsPerEdge);

            PortTownReturnPacket portTownPacket = PortTownPlacementGenerator.generatePortTownInformation_DemoVer(simplifiedLayout, upscaledLayout, roomWidthHeight, numOfVertsPerEdge);

            // return new TerrainBuilderReturnPacket(simplifiedLayout, upscaledLayout, returnMeshes);
            return(new TerrainBuilderReturnPacket(simplifiedLayout, upscaledLayout, meshData, portTownPacket));
        }
示例#4
0
        public static TerrainBuilderReturnPacket generateTerrain(float roomWidthHeight, int numOfVertsPerEdge, byte sizeOfExplorableArea, byte numberOfKeys)
        {
            System.Random random_forThread = new System.Random();

            // SimplifiedLayoutReturnPacket simplifiedLayout = SimplifiedLayoutTemplates.generateLayout_DebugRoom();
            Debug.Log("Size of area: " + sizeOfExplorableArea);
            SimplifiedLayoutReturnPacket simplifiedLayout = SimplifiedLayoutBuilder.generateLayout_Normal(sizeOfExplorableArea, numberOfKeys, random_forThread);

            UpscaledLayoutReturnPacket upscaledLayout = UpscaledLayoutBuilder.upscaleLayout_Game(simplifiedLayout, roomWidthHeight, numOfVertsPerEdge, random_forThread);

            // Mesh[,] returnMeshes = sliceHeightArrayIntoMultipleMeshes(upscaledLayout.getLandVertexHeights(), roomWidthHeight, numOfVertsPerEdge);
            TerrainMeshDataPacket[,] meshData = sliceHeightArrayIntoMultipleMeshes_2(upscaledLayout.getLandVertexHeights(), roomWidthHeight, numOfVertsPerEdge);

            PortTownReturnPacket portTownPacket = PortTownPlacementGenerator.generatePortTownInformation(simplifiedLayout, upscaledLayout, roomWidthHeight, numOfVertsPerEdge, sizeOfExplorableArea, random_forThread);

            // return new TerrainBuilderReturnPacket(simplifiedLayout, upscaledLayout, returnMeshes);
            return(new TerrainBuilderReturnPacket(simplifiedLayout, upscaledLayout, meshData, portTownPacket));
        }