public void Attach(Model.Dungeon model) { dungeon = model; // Load terrain sprites tiles.Clear(); for (int j = 0; j < dungeon.Height; j++) { for (int i = 0; i < dungeon.Width; i++) { Point point = new Point(i, j); Model.Dungeon.Cell cell = dungeon.GetCell(point); Tile tile = new Tile(); tile.Position = FieldToViewCoordinates(point); if (cell.Terrain == Model.Terrain.Floor) { tile.Origin = new Vector2(64.0F, 32.0F); tile.Texture = grassTile; } else if (cell.Terrain == Model.Terrain.Wall) { tile.Origin = new Vector2(64.0F, 80.0F); tile.Texture = treeTile; } tiles.Add(tile); } } tiles.Sort(CompareTiles); }
public void Attach(Model.Dungeon model) { dungeon = model; // Load terrain sprites tiles.Clear(); for (int j = 0; j < dungeon.Height; j++) { for (int i = 0; i < dungeon.Width; i++) { Point point = new Point(i, j); Model.Dungeon.Cell cell = dungeon.GetCell(point); Tile tile = new Tile(); tile.Position = FieldToViewCoordinates(point); if (cell.Terrain == Model.Terrain.Floor) { tile.Origin = new Vector2(64.0F, 32.0F); tile.Texture = grassTile; } else if (cell.Terrain == Model.Terrain.Wall) { tile.Origin = new Vector2(64.0F, 80.0F); tile.Texture = treeTile; } tiles.Add(tile); } } tiles.Sort(CompareTiles); }
public void Draw() { for (int j = 0; j < dungeon.Height; j++) { for (int i = 0; i < dungeon.Width; i++) { Point point = new Point(i, j); Model.Dungeon.Cell cell = dungeon.GetCell(point); List <Model.Entity> entities = dungeon.GetEntitiesAt(point); bool entityAt = false; for (int k = 0; k < entities.Count(); k++) { if (entities[i] is Model.Entities.Combatant) { Console.Write('@'); entityAt = true; break; } } if (!entityAt) { switch (cell.Terrain) { case Model.Terrain.Floor: Console.Write('.'); break; case Model.Terrain.Wall: Console.Write('#'); break; } } } Console.Write('\n'); } }