Exemplo n.º 1
0
        public async Task Populate(IWorld world, int x, int z, GeneratorSettings settings)
        {
            var chunkColumnKey = world.MakeAddressByPartitionKey(new ChunkWorldPos {
                X = x, Z = z
            });
            ChunkColumnCompactStorage chunkColumn = await GrainFactory.GetGrain <IChunkColumn>(chunkColumnKey).GetStateUnsafe();

            Biome chunkBiome = Biome.GetBiome(chunkColumn.Biomes[7 * 16 + 7], settings);

            if (chunkBiome.GetBiomeId() == BiomeId.Plains)
            {
                var decorator = GrainFactory.GetGrain <IBiomePlainsDecorator>((long)BiomeId.Plains);
                await decorator.Decorate(world, new ChunkWorldPos(x, z), settings);

                // decorator.SpawnMob(world, chunk, new ChunkWorldPos(x, z), new BlockWorldPos { X = blockX, Z = blockZ });
            }
            else if (chunkBiome.GetBiomeId() == BiomeId.Forest)
            {
                var decorator = GrainFactory.GetGrain <IBiomeForestDecorator>((long)BiomeId.Forest);
                await decorator.Decorate(world, new ChunkWorldPos(x, z), settings);
            }
            else if (chunkBiome.GetBiomeId() == BiomeId.Taiga)
            {
                var decorator = GrainFactory.GetGrain <IBiomeTaigaDecorator>((long)BiomeId.Taiga);
                await decorator.Decorate(world, new ChunkWorldPos(x, z), settings);
            }
            else if (chunkBiome.GetBiomeId() == BiomeId.Savanna)
            {
                var decorator = GrainFactory.GetGrain <IBiomeSavannaDecorator>((long)BiomeId.Savanna);
                await decorator.Decorate(world, new ChunkWorldPos(x, z), settings);
            }
        }