Exemple #1
0
        public static IMapGenerator Get(string gen, long Seed, MapGenMaterials Materials)
        {
            if (gen == null)
            {
                gen = "QuickHillGenerator";
            }
            if (Generators.Count == 0)
            {
                Generators.Add("QuickHillGenerator", typeof(QuickHillGenerator));
            }
            string id = "QuickHillGenerator";

            if (Generators.ContainsKey(gen))
            {
                id = gen;
            }
            Console.WriteLine("Initializing {0}.", id);
            IMapGenerator g = (IMapGenerator)Generators[id].GetConstructor(new Type[] { typeof(long) }).Invoke(new object[] { Seed });

            g.Materials        = Materials;
            g.GenerateCaves    = true;
            g.GenerateDungeons = true;
            g.GenerateOres     = true;
            g.GenerateWater    = true;
            g.HellMode         = false;
            g.GenerateTrees    = true;
            g.NoPreservation   = false;
            return(g);
        }
Exemple #2
0
		private void LoadMapGenerator()
		{
			string f = Path.Combine(mFolder, "mapgen.id");
			if (File.Exists(f))
			{
				string mg = File.ReadAllText(f);
				_Generator = MapGenerators.Get(mg, RandomSeed);
				_Generator.Load(mFolder);
			}
		}