public Map(int tileWidth, int tileHeight, int width, int height) { this.tileWidth = tileWidth; this.tileHeight = tileHeight; this.width = width; this.height = height; Layers = new List <TileLayer>(); Layers.Add(new TileLayer(tileWidth, tileHeight, width, height, "Base Layer")); Layers.Add(new TileLayer(tileWidth, tileHeight, width, height, "Second Layer")); CollisionLayer = new CollisionLayer(tileWidth, tileHeight, width, height); }
private void Load(Stream stream) { using (BinaryReader reader = new BinaryReader(stream)) { width = reader.ReadInt32(); height = reader.ReadInt32(); tileWidth = reader.ReadInt32(); tileHeight = reader.ReadInt32(); int layerCount = reader.ReadInt32(); for (int i = 0; i < layerCount; i++) { Layers.Add(new TileLayer(reader)); } CollisionLayer = new CollisionLayer(reader); } }