protected override void Draw(GameTime gameTime) { screen.Draw(spriteBatch); gameState.Draw(spriteBatch); // For testing, set showCollisions to true to show an outline around all colliders: if (showCollisions) { spriteBatch.Begin(); foreach (IGameObject g in currentRoom.Blocks.Concat <IGameObject>(currentRoom.Items).Concat(currentRoom.Enemies).Concat(currentRoom.NPCs).Concat(player.ActiveItems).Concat(new List <IGameObject>() { player, player.Sword })) { Rectangle rec = CollisionDetection.GetColliderRectangle(g, currentRoom.Position); spriteBatch.Draw(squareOutline, rec, new Color(Color.LimeGreen, 1)); } /*foreach (IGameObject g in currentRoom.Walls) * { * Rectangle rec = CollisionDetection.GetColliderRectangle(g, currentRoom.Position); * spriteBatch.Draw(squareOutline, rec, new Color(Color.Coral, .5f)); * }*/ foreach (IGameObject g in currentRoom.Doors) { Rectangle rec = CollisionDetection.GetColliderRectangle(g, currentRoom.Position); spriteBatch.Draw(squareOutline, rec, Color.Blue); } spriteBatch.End(); } if (reversingTime) { spriteBatch.Begin(); spriteBatch.Draw(rect, new Rectangle(new Point(0, 0), new Point(graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight)), new Color(.1f, .2f, .1f, .1f)); spriteBatch.End(); } if (notificationsQueue.Count() > 0) { spriteBatch.Begin(); spriteBatch.DrawString(font, notificationsQueue.Peek().notificationText, new Vector2(700, 8), Color.White); spriteBatch.End(); } base.Draw(gameTime); }
protected override void Draw(GameTime gameTime) { screen.Draw(spriteBatch); gameState.Draw(spriteBatch); // For testing, set showCollisions to true to show an outline around all colliders: if (showCollisions) { spriteBatch.Begin(); foreach (IGameObject g in currentRoom.Blocks.Concat <IGameObject>(currentRoom.Items).Concat(currentRoom.Enemies).Concat(currentRoom.NPCs).Concat(currentRoom.Doors).Concat(player.ActiveItems).Concat(new List <IGameObject>() { player, player.Sword })) { Rectangle rec = CollisionDetection.GetColliderRectangle(g); spriteBatch.Draw(squareOutline, rec, new Color(Color.LimeGreen, 1)); } spriteBatch.End(); } base.Draw(gameTime); }