Exemplo n.º 1
0
    public IEnumerator Generate()
    {
        if (loadedPreviouslyMadeWorld)
        {
            OverworldLoader.Load();
        }
        else
        {
            yield return(StartCoroutine(GenerateElevations()));
        }
        yield return(StartCoroutine(OverworldTerrainGenerator.Generate()));

        yield return(StartCoroutine(OverworldPrefabGenerator.Generate()));

        if (loadedPreviouslyMadeWorld)
        {
            OverworldLandmarkGenerator.Load();
        }
        else
        {
            yield return(StartCoroutine(OverworldLandmarkGenerator.Generate()));
        }
        SetStartGameCharacterPosition();
        GetComponent <NavMeshSurface>().BuildNavMesh();
        yield return(StartCoroutine(OverworldEncounterGenerator.Generate()));

        Camera.main.GetComponent <Desaturate>().enabled = false;
        LoadingProgressBar.EndLoad();
    }
Exemplo n.º 2
0
        public OverworldNoise(int seed)
        {
            generatorSettings = new OverworldTerrainSettings()
            {
                Seed = seed
            };

            generator       = new OverworldTerrainGenerator(generatorSettings);
            generatorModule = generator.CreateModule();

            cavePerlin = new Simplex
            {
                Frequency   = 1.14,
                Lacunarity  = 2.0,
                OctaveCount = 2,
                Persistence = 1.53
            };

            coalNoise = new Multiply
            {
                Source0 = new Checkerboard(),
                Source1 = new Perlin
                {
                    Frequency  = 1.14,
                    Lacunarity = 2.222,
                    Seed       = generatorSettings.Seed
                }
            };

            BiomeNoise = new Billow
            {
                Seed        = generatorSettings.Seed + 101,
                Frequency   = 43.25,
                Lacunarity  = generatorSettings.ContinentLacunarity,
                OctaveCount = 1,
                Quality     = NoiseQuality.Fast,
            };

            BiomeHumidity = new Billow
            {
                Seed        = generatorSettings.Seed + 101,
                Frequency   = 24.25,
                Lacunarity  = generatorSettings.ContinentLacunarity,
                OctaveCount = 1,
                Quality     = NoiseQuality.Fast,
            };
        }
Exemplo n.º 3
0
        public OverworldTerrain()
        {
            generatorSettings = new OverworldTerrainSettings(); //TODO: load settings from a file
            generator         = new OverworldTerrainGenerator(generatorSettings);
            generatorModule   = generator.CreateModule();

            biomePerlin = new Perlin
            {
                Seed      = generatorSettings.Seed,
                Frequency = 3
            };

            cavePerlin = new Perlin
            {
                Seed        = generatorSettings.Seed,
                Lacunarity  = 0,
                Quality     = SharpNoise.NoiseQuality.Fast,
                OctaveCount = 2
            };
        }
Exemplo n.º 4
0
        public OverworldNoise(int seed)
        {
            generatorSettings = new OverworldTerrainSettings()
            {
                Seed = seed
            };

            generator       = new OverworldTerrainGenerator(generatorSettings);
            generatorModule = generator.CreateModule();

            cavePerlin = new Simplex
            {
                Frequency   = 1.14,
                Lacunarity  = 2.0,
                OctaveCount = 2,
                Persistence = 1.53
            };

            coalNoise = new Multiply
            {
                Source0 = new Checkerboard(),
                Source1 = new Perlin
                {
                    Frequency  = 1.14,
                    Lacunarity = 2.222,
                    Seed       = generatorSettings.Seed
                }
            };

            BiomeNoise = new Turbulence()
            {
                Frequency = 43.25,
                Power     = 0.01,
                Roughness = 6,
                Seed      = generatorSettings.Seed + 100,
                Source0   = new Add()
                {
                    Source0 = new Clamp()
                    {
                        UpperBound = 2,
                        LowerBound = -0.1,
                        Source0    = new Billow()
                        {
                            Seed        = generatorSettings.Seed + 101,
                            Frequency   = 43.25,
                            Lacunarity  = generatorSettings.ContinentLacunarity,
                            OctaveCount = 1,
                            Quality     = NoiseQuality.Fast,
                        }
                    },
                    Source1 = new Clamp()
                    {
                        UpperBound = 0.1,
                        LowerBound = -2,
                        Source0    = new Invert()
                        {
                            Source0 = new Billow()
                            {
                                Seed        = generatorSettings.Seed + 102,
                                Frequency   = 43.25,
                                Lacunarity  = generatorSettings.ContinentLacunarity,
                                OctaveCount = 1,
                                Quality     = NoiseQuality.Fast,
                            }
                        }
                    }
                }
            };

            BiomeHumidity = new Turbulence()
            {
                Frequency = 47.25,
                Power     = 0.01,
                Roughness = 6,
                Seed      = generatorSettings.Seed + 103,
                Source0   = new Add()
                {
                    Source0 = new Clamp()
                    {
                        UpperBound = 2,
                        LowerBound = -0.1,
                        Source0    = new Billow()
                        {
                            Seed        = generatorSettings.Seed + 104,
                            Frequency   = 47.25,
                            Lacunarity  = generatorSettings.ContinentLacunarity,
                            OctaveCount = 1,
                            Quality     = NoiseQuality.Fast,
                        }
                    },
                    Source1 = new Clamp()
                    {
                        UpperBound = 0.1,
                        LowerBound = -2,
                        Source0    = new Invert()
                        {
                            Source0 = new Billow()
                            {
                                Seed        = generatorSettings.Seed + 105,
                                Frequency   = 47.25,
                                Lacunarity  = generatorSettings.ContinentLacunarity,
                                OctaveCount = 1,
                                Quality     = NoiseQuality.Fast,
                            }
                        }
                    }
                }
            };
        }