Draw dragons in different colors than players

This commit is contained in:
2014-05-02 10:05:18 +02:00
parent 849d764c92
commit 8342d5e3bf

View File

@@ -80,18 +80,18 @@ namespace WorldOfPeacecraft
IEnumerable<IPositionable> dragons = Backend.GetDragons (); IEnumerable<IPositionable> dragons = Backend.GetDragons ();
IEnumerable<IPositionable> players = Backend.GetPlayers (); IEnumerable<IPositionable> players = Backend.GetPlayers ();
foreach (IPositionable dragon in dragons) { foreach (IPositionable dragon in dragons) {
PaintEntity (g, dragon); PaintEntity (g, dragon, Color.Red);
} }
foreach (IPositionable player in players) { foreach (IPositionable player in players) {
PaintEntity (g, player); PaintEntity (g, player, Color.LightGreen);
} }
} }
public void PaintEntity (Graphics g, IPositionable entity) public void PaintEntity (Graphics g, IPositionable entity, Color color)
{ {
int x = entity.GetX () * TileSize + TileSize / 2 - EntitySize / 2; int x = entity.GetX () * TileSize + TileSize / 2 - EntitySize / 2;
int y = entity.GetY () * TileSize + TileSize / 2 - EntitySize / 2; int y = entity.GetY () * TileSize + TileSize / 2 - EntitySize / 2;
g.FillRectangle (new SolidBrush (Color.Red), x, y, EntitySize, EntitySize); g.FillRectangle (new SolidBrush (color), x, y, EntitySize, EntitySize);
g.DrawRectangle (new Pen( new SolidBrush (Color.Black)), x, y, EntitySize, EntitySize); g.DrawRectangle (new Pen( new SolidBrush (Color.Black)), x, y, EntitySize, EntitySize);
} }
} }