Example #1
0
        public void generateIsland()
        {
            gen = generators[(int)terrainDifficulty][new Random().Next(generators[(int)terrainDifficulty].Length)];
            //gen = new SmoothWithBluffsGenerator();////!
            if (Player.galleryMode)
            {
                bool timeToRegen = IslandGeneratorLoader.updateAndReturnIfNewCodeIsReady();
                if (timeToRegen)
                {
                    gen = IslandGeneratorLoader.getGenerator();
                }
            }

            gen.generateIsland(chunkSpace, setPieceManager, jobSiteManager, getLocationProfile());
        }
Example #2
0
        public void generationThreadTask()
        {
            while (true)
            {
                lock (generationQueue)
                {
                    if (Player.galleryMode)
                    {
                        generationQueue.Clear();
                        bool timeToRegen = IslandGeneratorLoader.updateAndReturnIfNewCodeIsReady();
                        if (timeToRegen)
                        {
                            lock (islands)
                            {
                                islands.Clear();
                            }
                            Island island = new Island(new Vector3(), Island.TerrainType.easy);
                            island.generateWithGenerator(IslandGeneratorLoader.getGenerator());
                            lock (islands)
                            {
                                addIsland(island);
                            }
                        }
                    }


                    foreach (Island toUpdate in generationQueue)
                    {
                        if (!toUpdate.hasBeenGenerated)
                        {
                            generateAndAddIslandToList(toUpdate);
                        }
                    }
                    generationQueue.Clear();
                }
                Thread.Sleep(1);
            }
        }