private void Generate()
        {
            GeneratePalette();

            config.gradient = ColorE.Gradient(GetMainColorHSV(), GetSecondaryColorHSV());

            breakout.Generate(config);
        }
Esempio n. 2
0
        public void Generate()
        {
            targetPalette = RandomE.TetradicPalette(0.25f, 0.75f);
            targetPalette.Add(ColorHSV.Lerp(targetPalette[0], targetPalette[1], 0.5f));

            config.gradient = ColorE.Gradient(from: targetPalette[2].WithSV(0.8f, 0.8f),
                                              to: targetPalette[3].WithSV(0.8f, 0.8f));

            var draft = LowPolyTerrainGenerator.TerrainDraft(config);

            draft.Move(Vector3.left * config.terrainSize.x / 2 + Vector3.back * config.terrainSize.z / 2);
            meshFilter.mesh = draft.ToMesh();
        }
Esempio n. 3
0
        public void Generate()
        {
            Vector3 terrainSize = new Vector3(terrainSizeX, terrainSizeY, terrainSizeZ);

            targetPalette = RandomE.TetradicPalette(0.25f, 0.75f);
            targetPalette.Add(ColorHSV.Lerp(targetPalette[0], targetPalette[1], 0.5f));

            var gradient = ColorE.Gradient(targetPalette[2].WithS(0.8f).WithV(0.8f),
                                           targetPalette[3].WithS(0.8f).WithV(0.8f));

            var draft = LowPolyTerrainGenerator.TerrainDraft(terrainSize, cellSize, noiseScale, gradient);

            draft.Move(Vector3.left * terrainSizeX / 2 + Vector3.back * terrainSizeZ / 2);
            meshFilter.mesh = draft.ToMesh();
        }
Esempio n. 4
0
    public Gradient BlendGradient(Gradient terrain_gradient, Gradient object_gradient)
    {
        List <ColorHSV> targetPalette  = new List <ColorHSV>();
        List <ColorHSV> currentPalette = new List <ColorHSV>();

        targetPalette = RandomE.TetradicPalette(0.25f, 0.75f);
        Debug.Log(targetPalette.Count);
        ColorHSV groundColor = new ColorHSV(terrain_gradient.Evaluate(0));
        ColorHSV newColor    = new ColorHSV(object_gradient.Evaluate(1));

        targetPalette.Add(ColorHSV.Lerp(groundColor, newColor, 0.5f));
        var gradient = ColorE.Gradient(from: targetPalette[2].WithSV(0.8f, 0.8f),
                                       to: targetPalette[3].WithSV(0.8f, 0.8f));

        return(object_gradient);
    }
        public void Generate(bool randomizeConfig = true)
        {
            if (constantSeed)
            {
                Random.InitState(0);
            }

            if (randomizeConfig)
            {
                GeneratePalette();

                config.gradient = ColorE.Gradient(from: GetMainColorHSV(), to: GetSecondaryColorHSV());
            }

            var draft = LowPolyTerrainGenerator.TerrainDraft(config);

            draft.Move(Vector3.left * config.terrainSize.x / 2 + Vector3.back * config.terrainSize.z / 2);
            AssignDraftToMeshFilter(draft, terrainMeshFilter, ref terrainMesh);
        }
Esempio n. 6
0
        private void Awake()
        {
            RenderSettings.skybox = new Material(RenderSettings.skybox);
            meshCollider          = terrain.GetComponents <MeshCollider>()[0];

            //Generate Gradient for scene
            targetPalette = RandomE.TetradicPalette(0.25f, 0.75f);
            targetPalette.Add(ColorHSV.Lerp(targetPalette[0], targetPalette[1], 0.5f));
            var gradient = ColorE.Gradient(from: targetPalette[2].WithSV(0.8f, 0.8f),
                                           to: targetPalette[3].WithSV(0.8f, 0.8f));

            grad = gradient;

            targetPalette = RandomE.TetradicPalette(0.25f, 0.75f);
            targetPalette.Add(ColorHSV.Lerp(targetPalette[0], targetPalette[1], 0.5f));
            var gradient2 = ColorE.Gradient(from: targetPalette[2].WithSV(0.8f, 0.8f),
                                            to: targetPalette[3].WithSV(0.8f, 0.8f));

            grad2 = gradient2;


            Generate();
            currentPalette.AddRange(targetPalette);

            for (int i = 0; i < 10; i++)
            {
                Vector3 terrainSize = new Vector3(terrainSizeX, terrainSizeY, terrainSizeZ);
                var     temp_draft  = LowPolyTerrainGenerator.TerrainDraft(terrainSize, cellSize, noiseScale, grad);
                temp_draft.Move(Vector3.left * terrainSizeX / 2 + Vector3.back * terrainSizeZ / 2);
                pregen_graphs.Add(temp_draft);
                GameObject temp = (GameObject)Instantiate(terrain, new Vector3(0, -100, 0), terrain.transform.rotation);
                UpdateDraft(temp, temp_draft);
                pre_terrains.Add(temp);
                // temp.GetComponent<BoxCollider>().
            }
            foreach (GameObject g in pre_terrains)
            {
                g.GetComponent <ObjectSpawner>().gradient1 = grad;
                g.GetComponent <ObjectSpawner>().gradient2 = grad2;
            }
        }