Esempio n. 1
0
    public void Generate(SunSettings aSunSettings, SystemSettings aSystemSettings)
    {
        sunSettings    = aSunSettings;
        systemSettings = aSystemSettings;

        // Create Objects
        sphereCreator = new SphereCreator(sunSettings);
        state         = sunSettings.stateManager.state;

        // Generate World
        mesh = sphereCreator.CreateSphere();

        // Apply Mesh
        GetComponent <MeshFilter>().mesh = mesh.Render();

        // Setup Light
        sunLight = sunSettings.sunLight;
        sunLight.GetComponent <Light>().color     = sunSettings.sunLightSettings.colour;
        sunLight.GetComponent <Light>().intensity = sunSettings.sunLightSettings.intensity;

        // Position Objects
        transform.position          = new Vector3(sunSettings.distanceToWorld, 0, 0);
        sunInitialPos               = transform.position;
        sunLight.transform.position = Vector3.zero;
    }
    void Update()
    {
        // float height = 1 + 0.9f * Perlin.Noise(col * size.x * (float)1.2, row * size.z * (float)1.2, Random.Range(0.05f, 0.5f));
        float vertexChange = 1 + 0.9f * Perlin.Noise((float)1.2, radius * (float)1.2, Random.Range(1.0f, 2.5f));
        // Mesh sphereMesh = GetComponent<MeshFilter>().mesh = SphereCreator.Create(subdivisions, radius);
        MeshFilter meshFilter = GetComponent <MeshFilter>();

        meshFilter.mesh = SphereCreator.Create(subdivisions, radius, vertexChange);;


        mc.Clear(); // Clear internal lists and mesh
    }
Esempio n. 3
0
    public void Generate(WorldSettings aWorldSettings, SystemSettings aSystemSettings)
    {
        // Initialise
        transform.position = Vector3.zero;
        worldSettings      = aWorldSettings;
        systemSettings     = aSystemSettings;
        sphereCreator      = new SphereCreator(worldSettings);
        noiseFilter        = new NoiseFilter(worldSettings.noiseSettings);

        // Generate World
        mesh = sphereCreator.CreateSphere();

        foreach (Vertice vertice in mesh.vertices)
        {
            float height = noiseFilter.Evaluate(vertice.position);
            vertice.height = height;
        }

        GetComponent <MeshFilter>().mesh = mesh.Render();
    }