public Map(string name, Vector2i size, int cellSize = 32) { Name = name; Size = size; CellSize = cellSize; Center = new Vector2f(); Layer0Cells = new MapCell[size.X, size.Y]; Layer1Cells = new MapCell[size.X, size.Y]; Layer2Cells = new MapCell[size.X, size.Y]; for (var x = 0; x < Size.X; x++) { for (var y = 0; y < Size.Y; y++) { Layer0Cells[x, y] = new MapCell(); Layer1Cells[x, y] = new MapCell(); Layer2Cells[x, y] = new MapCell(); } } _entities = new List<Entity>(); _lights = new List<PointLight>(); AmbientLightColor = Color.White; _lightTexture = new RenderTexture((uint) (size.X * cellSize), (uint) (size.Y * cellSize)); _lightSprite = new Sprite(_lightTexture.Texture); }
public static MapCell Read(BinaryReader br) { var cell = new MapCell(); var tileCount = br.ReadInt32(); for (var i = 0; i < tileCount; i++) cell.Tiles.Push(new TileSprite(br.ReadString(), br.ReadBoolean())); return cell; }