Example #1
0
        public void DebugDraw()
        {
            foreach (Tile2D tile in player.debugCollidingTiles)
            {
                Position2D position  = tile.ToPixelUnit2D();
                Rectangle  rectangle = RectangleExtensions.NewRectangle(position, new Tile2D(new Vector2(1)).ToPixelUnit2D());
                DrawRectangleOutline(rectangle, 1, Color.Red);
            }

            foreach (Tile2D tile in player.debugOppositeCollidingTiles)
            {
                Position2D position  = tile.ToPixelUnit2D();
                Rectangle  rectangle = RectangleExtensions.NewRectangle(position, new Tile2D(new Vector2(1)).ToPixelUnit2D());
                DrawRectangleOutline(rectangle, 1, Color.Green);
            }

            foreach (IPickup pickup in pickups.pickups)
            {
                if (pickup.Type == Pickup.PickupType.Experience)
                {
                    PowerDoritoPickup dorito = (PowerDoritoPickup)pickup;
                    foreach (Tile2D tile in dorito.debugCollidingTiles)
                    {
                        Position2D position  = tile.ToPixelUnit2D();
                        Rectangle  rectangle = RectangleExtensions.NewRectangle(position, new Tile2D(new Vector2(1)).ToPixelUnit2D());
                        DrawRectangleOutline(rectangle, 1, Color.Red);
                    }

                    foreach (Tile2D tile in dorito.debugOppositeCollidingTiles)
                    {
                        Position2D position  = tile.ToPixelUnit2D();
                        Rectangle  rectangle = RectangleExtensions.NewRectangle(position, new Tile2D(new Vector2(1)).ToPixelUnit2D());
                        DrawRectangleOutline(rectangle, 1, Color.Green);
                    }
                }
            }
        }
 public static Rectangle NewRectangle(Position2D position, Dimensions2D dimensions)
 {
     return(new Rectangle((int)Math.Round(position.value.X), (int)Math.Round(position.value.Y),
                          (int)Math.Round(dimensions.value.X), (int)Math.Round(dimensions.value.Y)));
 }
 public static Rectangle NewRectangle(Position2D position, Dimensions2D dimensions)
 {
     return new Rectangle((int)Math.Round(position.value.X), (int)Math.Round(position.value.Y),
         (int)Math.Round(dimensions.value.X), (int)Math.Round(dimensions.value.Y));
 }