예제 #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));
        }
예제 #2
0
        private void Load(BinaryReader br, bool isMultiplayer)
        {
            this.sizeXbits = br.ReadInt32();
            this.sizeYbits = br.ReadInt32();
            this.sizeZbits = br.ReadInt32();

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

            if (isMultiplayer == false)
            {
                string gameplayId = br.ReadString();

                gameplay = GameplayFactory.GetGameplayById(gameplayId);
                gameplay.Init(this);
                gameplay.Load(br);
            }
            else
            {
                gameplay.Init(this);
            }

            configSurroundings = new ConfigSurroundings();
            configSurroundings.Load(br);
        }