Esempio n. 1
0
        public void Execute(GeneratedTile tile, int x, int y, int seed)
        {
            if (!enabled)
            {
                return;
            }

            switch (type)
            {
            case TileModType.Noise:
                int noise = LogicWorld.Noise(x, y, p1, seed + p3 << 6, LogicTween.SCALE);
                tile.altitude = LogicWorld.Lerp(tile.altitude, noise, p2);
                break;

            case TileModType.Plateau:
                int plateau = LogicWorld.Plateau(tile.altitude, LogicTween.SCALE * p1 / 100);
                tile.altitude = LogicWorld.Lerp(tile.altitude, plateau, p2);
                break;

            case TileModType.TerrainSet:
                if (tile.altitude > (LogicTween.SCALE * p1 / 100) && tile.altitude < (LogicTween.SCALE * p2 / 100))
                {
                    tile.terrain = (TerrainType)p3;
                }
                break;
            }
        }
Esempio n. 2
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());
                }
            }
        }