Esempio n. 1
0
        public override void OnInspectorGUI()
        {
            HexMapGenerator mapGen = (HexMapGenerator)target;

            if (GUILayout.Button("Generate") || DrawDefaultInspector())
            {
                mapGen.GenerateMap();
            }

            if (GUILayout.Button("Next Step"))
            {
                mapGen.NextGeneration();
                SceneView.RepaintAll();
            }

            if (GUILayout.Button("Clear Tile Map"))
            {
                mapGen.ClearMap();
            }

            if (GUILayout.Button("Expand"))
            {
                mapGen.RevealArea(new Vector3Int(40, -50, 0), 50);
            }
        }
Esempio n. 2
0
        public static Dictionary <TerrainType, List <Region> > RunGeneration(HexMapGenerator hexMapGenerator)
        {
            mapGen = hexMapGenerator;
            rules  = mapGen.stageOne;

            if (rules.useNoise)
            {
                FillMapArea(Vector3Int.zero, rules.initialViewRadius);
            }
            else
            {
                RandomFillMap();
            }


            for (int i = 0; i < rules.smoothSteps; ++i)
            {
                if (!SmoothMap(Vector3Int.zero))
                {
                    break;
                }
            }

            return(ProcessMap());
        }
Esempio n. 3
0
        public static void RunGeneration(HexMapGenerator hexMapGenerator,
                                         Dictionary <TerrainType, List <Region> > regionDict)
        {
            mapGen = hexMapGenerator;
            rules  = mapGen.stageTwo;

            //FillLandRegionsWithNoiseTerrain(regionDict[TerrainType.LandGenerator]);
            tiles = FillLandRegionsWithRandomTerrain(regionDict[TerrainType.LandGenerator]);

            if (!RunSimulation(tiles))
            {
                Debug.Log("Simulation stable!");
            }
        }