private void DrawGame() { //Draw stuff here terrain.Draw(drawBatch); for (int i = 0; i < agents.Count; i++) { agents[i].Draw(drawBatch); if (agents[i].state == Agent.State.Walking) { for (int j = 0; j < agents[i].path.instructions.Length; j++) { drawBatch.Draw(DrawBatch.DrawCall.Tag.GameObject, pixel, new Rectangle(agents[i].path.instructions[j].X * 16, agents[i].path.instructions[j].Y * 16, World.tileSize, World.tileSize), Color.Lerp(Color.Black, Color.Transparent, .5f), 1f); } } } for (int i = 0; i < gameObjects.Count; i++) { gameObjects[i].Draw(drawBatch); } List <Point> intersectingTiles = new List <Point>(); Point p = new Point(-1); if (MouseButtonDownLeft(false)) { /* * if (terrain.RayCastObstacle(SelectionHandler.selectionPoint.ToVector2(), SelectionHandler.selectionPointSecond.ToVector2(), out p, out intersectingTiles)) * { * DrawLine(drawBatch, SelectionHandler.selectionPoint.ToVector2(), SelectionHandler.selectionPointSecond.ToVector2(), 2, Color.Red, 1f); * drawBatch.Draw(DrawBatch.DrawCall.Tag.GameObject, pixel, new Rectangle(p.X * World.tileSize, p.Y * World.tileSize, World.tileSize, World.tileSize), Color.Lerp(Color.Red, Color.Transparent, .5f), 1f); * } * else * DrawLine(drawBatch, SelectionHandler.selectionPoint.ToVector2(), SelectionHandler.selectionPointSecond.ToVector2(), 2, Color.Green, 1f); * * for (int i = 0; i < intersectingTiles.Count; i++) * { * drawBatch.Draw(DrawBatch.DrawCall.Tag.GameObject, pixel, new Rectangle(intersectingTiles[i].X * World.tileSize, intersectingTiles[i].Y * World.tileSize, World.tileSize, World.tileSize), Color.Lerp(Color.Blue, Color.Transparent, .5f), 1f); * } */ } drawBatch.Draw(DrawBatch.DrawCall.Tag.GameObject, pixel, new Rectangle((int)mousePosInWorld.X - 2, (int)mousePosInWorld.Y - 2, 4, 4), Color.Green, 1f); if (SelectionHandler.CurrentTarget == SelectionHandler.Target.Tile) { drawBatch.Draw(DrawBatch.DrawCall.Tag.GameObject, pixel, new Rectangle(mouseTile.X * World.tileSize, mouseTile.Y * World.tileSize, World.tileSize, World.tileSize), Color.Lerp(Color.Lime, Color.Transparent, .5f), 1f); } if (SelectionHandler.CurrentTarget == SelectionHandler.Target.Tile) { for (int i = 0; i < SelectionHandler.TileRectangle.Width; i++) { for (int j = 0; j < SelectionHandler.TileRectangle.Height; j++) { if ((SelectionHandler.TileRectangle.X + i) * World.tileSize > 0 && (SelectionHandler.TileRectangle.Y + i) * World.tileSize > 0) { drawBatch.Draw(DrawBatch.DrawCall.Tag.GameObject, pixel, new Rectangle((SelectionHandler.TileRectangle.X + i) * World.tileSize, (SelectionHandler.TileRectangle.Y + j) * World.tileSize, World.tileSize, World.tileSize), Color.Lerp(Color.Purple, Color.Transparent, .5f), 1f); } } } } else { drawBatch.Draw(DrawBatch.DrawCall.Tag.GameObject, pixel, SelectionHandler.SelectionRectangle, Color.Lerp(Color.Olive, Color.Transparent, .5f), 1f); } for (int i = 0; i < effects.Count; i++) { if (effects[i].remove) { effects.RemoveAt(i); i--; } else { effects[i].Draw(drawBatch); } } DrawLights(); DrawRectangle(drawBatch, camera.Rectangle, 2f, Color.OrangeRed, 1f); //Draw GameWorld to the scene and rendertarget GraphicsDevice.SetRenderTarget(RTGameWorld); GraphicsDevice.Clear(Color.White); spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, null, null, null, null, camera.get_transformation(GraphicsDevice)); drawBatch.DrawSceneGameObjects(spriteBatch); spriteBatch.End(); }