public override void Draw() { BGraphics.Draw( spritesheet, this.position - (new Vector2(DrawBox.Width / 2f, DrawBox.Height / 1.35f)), new Vector2((DrawBox.Width / currentSprite.Width), (DrawBox.Height / currentSprite.Height)), Color.Transparent, Vector2.Zero, currentSprite ); if (AppSettings.SETTING_COLLISION_DEBUG) { BGraphics.DrawRec(this.position - (new Vector2(CollisionBox.Width, CollisionBox.Height) / 2f), CollisionBox, Color.AliceBlue); } }
public override void Draw() { Camera.ApplyTransform(); base.Draw(); for (int x = 0; x < Level.Width; x++) { for (int y = 0; y < Level.Height; y++) { RectangleF source = Level[x, y].TexturePosition; BGraphics.Draw(Textures[0], new Vector2(x * AppInfo.GRIDSIZE, y * AppInfo.GRIDSIZE), new Vector2((float)AppInfo.GRIDSIZE / AppInfo.TILESIZE), Color.Transparent, Vector2.Zero, source); } } List <BEntity> renderOrder = new List <BEntity>(); renderOrder.AddRange(Level.Entities); if (Player != null) { renderOrder.Add(Player); } renderOrder = renderOrder.OrderBy(x => x.GroundLevel).ToList <BEntity>(); foreach (BEntity entity in renderOrder) { if (entity == null) { return; } entity.Draw(); } if (AppSettings.SETTING_NAVIGATION_DEBUG) { for (int x = 0; x < NavMesh.Width; x++) { for (int y = 0; y < NavMesh.Height; y++) { var color = Color.Green; if (NavMesh[x, y].Obstructed) { color = Color.Red; } else if (!NavMesh[x, y].Visited) { color = Color.Black; } BGraphics.DrawRec(new Vector2(x * NavMesh.TileSizeX, y * NavMesh.TileSizeY), new RectangleF(x * NavMesh.TileSizeX, y * NavMesh.TileSizeY, NavMesh.TileSizeX, NavMesh.TileSizeY), color); } } } if (AppSettings.SETTING_PATHFINDING_DEBUG) { if (NavMesh.DestNode != null) { BPathNode pathNode = NavMesh.DestNode; BGraphics.DrawRec(new Vector2(pathNode.X * NavMesh.TileSizeX, pathNode.Y * NavMesh.TileSizeY), new RectangleF(pathNode.X * NavMesh.TileSizeX, pathNode.Y * NavMesh.TileSizeY, NavMesh.TileSizeX, NavMesh.TileSizeY), Color.Orange); while (pathNode.Parent != null) { BGraphics.DrawRec(new Vector2(pathNode.X * NavMesh.TileSizeX, pathNode.Y * NavMesh.TileSizeY), new RectangleF(pathNode.X * NavMesh.TileSizeX, pathNode.Y * NavMesh.TileSizeY, NavMesh.TileSizeX, NavMesh.TileSizeY), Color.Yellow); pathNode = pathNode.Parent; } } } }