private void DrawUI(MapManager mm, Graphics gfx) { Tile center = mm.GetCenterTile(); int tileSize = mm.GetTileSize(); gfx.DrawString("Food eaten: " + score.ToString(), new Font("Arial", 10), new SolidBrush(Color.Black), center.X * tileSize, 0); if (GetGameState() == GameState.Over) { gfx.DrawString("GAME OVER", new Font("Arial", 20), new SolidBrush(Color.Black), center.X * tileSize, center.Y * tileSize); } if (GetGameState() == GameState.Pausing) { gfx.DrawString("PAUSED", new Font("Arial", 20), new SolidBrush(Color.Black), center.X * tileSize, center.Y * tileSize); } }
public void AddSnakeToMap(MapManager mm) { SnakePart snakeTail = snakeParts.First(); mm.PlaceItemOnTile(mm.GetCenterTile(), snakeTail); for (LinkedListNode <SnakePart> currentNode = snakeParts.First; currentNode != null;) { LinkedListNode <SnakePart> nextNode = currentNode.Next; if (nextNode != null) { Tile tile = mm.GetTileInFrontOfSnakePart(currentNode.Value); mm.PlaceItemOnTile(tile, nextNode.Value); } currentNode = nextNode; } }