public static void IterateHexaSphere(ref HexaSphere hexaSpehre, Vector2 bx, Vector2 sy, int iterationCount) { for (int i = 0; i < iterationCount; i++) { foreach (Cell c1 in hexaSpehre.Cells) { int aliveNeighbourCount = CheckAliveNeighbourCount(c1); if (aliveNeighbourCount >= bx.x && aliveNeighbourCount <= bx.y) { c1.CellState = true; } if (aliveNeighbourCount < sy.x && aliveNeighbourCount > sy.y) { c1.CellState = false; } } } }
void GenerateMesh() { //for (int i = 0; i < 6; i++) //{ // if (meshFilters[i].gameObject.activeSelf) // { // waterFaces[i].ConstructMesh(waterSettings.sphereRadius, waterSettings.lowPolyGeneration); // meshColliders[i] = waterFaces[i].InitMeshCollider(meshFilters[i].gameObject); // } //} if (meshFilter != null) { Mesh newMesh = HexaSphere.BuildMesh(waterSettings.recursionLevel, waterSettings.sphereRadius); //if (waterSettings.lowPolyGeneration) //{ // Vector3[] flatVertices = new Vector3[newMesh.triangles.Length]; // //Vector2[] flatUvs = new Vector2[newMesh.triangles.Length]; // for (int i = 0; i < newMesh.triangles.Length; i++) // { // flatVertices[i] = newMesh.vertices[newMesh.triangles[i]]; // //flatUvs[i] = newMesh.uv[newMesh.triangles[i]]; // newMesh.triangles[i] = i; // } // newMesh.vertices = flatVertices; // //newMesh.uv = flatUvs; //} meshFilter.sharedMesh = newMesh; meshFilter.sharedMesh.RecalculateNormals(); meshFilter.GetComponent <MeshRenderer>().sharedMaterial = material; } }
public void CreatePlanet() { icosphere = new IcoSphere(divisions); hexaSphere = new HexaSphere(icosphere); }