Ejemplo n.º 1
0
        public World2D Create(Range <float> depthRange, int chunkSize)
        {
            byte layerCount = (byte)colorMaps.Count;
            var  world      = new World2D(GameScale.TileSize, layerCount, depthRange, chunkSize, (int)Math.Ceiling(LevelSize.X / (float)chunkSize), (int)Math.Ceiling(LevelSize.Y / (float)chunkSize));

            for (var layer = 0; layer < layerCount; layer++)
            {
                for (var y = 0; y < LevelSize.Y; y++)
                {
                    for (var x = 0; x < LevelSize.Y; x++)
                    {
                        var tile = GetTileForColor(colorMaps[layer][x + y * LevelSize.X]);
                        if (tile != null)
                        {
                            world.PlaceTile(x, y, layer, tile);
                        }
                    }
                }
            }
            return(world);
        }