Ejemplo n.º 1
0
        public GeneratorProcess Generate(Config config)
        {
            this.sizeXbits = config.worldSize.worldSizeBitsX;
            this.sizeYbits = config.worldSize.worldSizeBitsY;
            this.sizeZbits = config.worldSize.worldSizeBitsZ;

            sizeX = 1 << sizeXbits;
            sizeY = 1 << sizeYbits;
            sizeZ = 1 << sizeZbits;

            gameplay = config.gameplay.gameplay;
            gameplay.Init(this);
			
			tileManager.Create(config.tileDefinitions, sizeXbits, sizeYbits, sizeZbits);
			itemManager.Create(config.itemDefinitions);
			
            avatarManager.Create(config.avatarDefinitions);

			sectorManager.Create();
			dayCycleManager.Create(config.dayInfo);

            configSurroundings = config.worldGenerator.surroundings;
            configExtraMaterials = config.extraMaterials;

            MemoryStream ms = new MemoryStream();
            BinaryWriter bw = new BinaryWriter(ms);

            return gameplay.Generate(config);
		}
Ejemplo n.º 2
0
        private ConfigExtraMaterials ParseExtraMaterials(XmlElement extraMaterialsXML)
        {
            ConfigExtraMaterials extra = new ConfigExtraMaterials();

            string[] damageMaterials = extraMaterialsXML["DamageMaterials"].InnerText.Split(',');
            extra.damageMaterials = new int[damageMaterials.Length];
            for (int i = 0; i < damageMaterials.Length; i++)
                extra.damageMaterials[i] = int.Parse(damageMaterials[i]);

            string[] fireMaterials = extraMaterialsXML["FireMaterials"].InnerText.Split(',');
            extra.fireMaterials = new int[fireMaterials.Length];
            for (int i = 0; i < fireMaterials.Length; i++)
                extra.fireMaterials[i] = int.Parse(fireMaterials[i]);

            return extra;
        }