Exemplo n.º 1
0
        public static void PlotNodes(LogicHexMap map, List <LogicHex> nodes, int radius, TerrainType terrain)
        {
            for (int i = 0; i < nodes.Count; ++i)
            {
                LogicHex node = nodes[i];

                int tile = map.Get(node);
                tile = LogicTile.SetTerrain(tile, terrain);

                map.Set(node, tile);
            }
        }
Exemplo n.º 2
0
        public static void AltitudeAbsNoise(LogicHexMap map, int octave, int seed, int percent)
        {
            for (int r = 0; r < map.height; ++r)
            {
                for (int q = 0; q < map.width; ++q)
                {
                    int         tile     = map.Get(q, r);
                    int         altitude = LogicTile.GetAltitude(tile);
                    LogicPoint3 pos      = HexToLogicPos(new LogicHex(q, r), altitude * ALTITUDE_SCALE);


                    int noise = LogicPerlinNoise.Noise((pos.x << octave) + seed, (pos.z << octave) + seed, seed << 2, LogicTween.SCALE);


                    int  distanceToMiddle = (noise - LogicTween.SCALE_HALF);
                    bool flip             = false;
                    if (distanceToMiddle < 0)
                    {
                        distanceToMiddle = -distanceToMiddle;
                        flip             = true;
                    }
                    distanceToMiddle = LogicTween.QuadIn(distanceToMiddle * 2) / 2;
                    if (flip)
                    {
                        distanceToMiddle = -distanceToMiddle;
                    }

                    noise = LogicTween.SCALE_HALF + distanceToMiddle;
                    noise = noise / (LogicTween.SCALE / LogicTile.MAX_ALTITUDE);



                    /*int noise = LogicPerlinNoise.Noise((pos.x << octave) + seed, (pos.z << octave) + seed, seed << 2, LogicTile.MAX_ALTITUDE*2);
                     * noise -= LogicTile.MAX_ALTITUDE;
                     * if (noise < 0)
                     *  noise = -noise;
                     *
                     *
                     * LogicTween.QuadIn();
                     */

                    //noise = LogicPerlinNoise.ScaleNoise(noise, LogicTile.MAX_ALTITUDE);

                    altitude = Lerp(altitude, noise, percent);
                    tile     = LogicTile.SetAltitude(tile, altitude);



                    map.Set(q, r, tile);
                }
            }
        }
Exemplo n.º 3
0
        public static void AltitudeFlip(LogicHexMap map, int cutoff)
        {
            for (int r = 0; r < map.height; ++r)
            {
                for (int q = 0; q < map.width; ++q)
                {
                    int tile     = map.Get(q, r);
                    int altitude = LogicTile.GetAltitude(tile);



                    tile = LogicTile.SetAltitude(tile, altitude);
                    map.Set(q, r, tile);
                }
            }
        }
Exemplo n.º 4
0
        public static void AltitudeNoise(LogicHexMap map, int octave, int seed, int percent)
        {
            for (int r = 0; r < map.height; ++r)
            {
                for (int q = 0; q < map.width; ++q)
                {
                    int         tile     = map.Get(q, r);
                    int         altitude = LogicTile.GetAltitude(tile);
                    LogicPoint3 pos      = HexToLogicPos(new LogicHex(q, r), altitude * ALTITUDE_SCALE);

                    int noise = LogicPerlinNoise.Noise((pos.x << octave) + seed, (pos.z << octave) + seed, seed << 2, LogicTile.MAX_ALTITUDE);

                    altitude = Lerp(altitude, noise, percent);
                    tile     = LogicTile.SetAltitude(tile, altitude);

                    map.Set(q, r, tile);
                }
            }
        }
Exemplo n.º 5
0
        public void GenerateMap()
        {
            int seed = config.seed;

            random.setIteratedRandomSeed(seed);

            for (int r = 0; r < map.height; ++r)
            {
                for (int q = 0; q < map.width; ++q)
                {
                    GeneratedTile tile = new GeneratedTile();

                    LogicPoint3 pos = HexToLogicPos(new LogicHex(q, r), 0);

                    for (int i = 0; i < config.tileMods.Count; ++i)
                    {
                        LogicTileMod mod = config.tileMods[i];
                        mod.Execute(tile, pos.x, pos.z, seed);
                    }

                    map.Set(q, r, tile.GetLogicTile());
                }
            }
        }