Esempio n. 1
0
 public CollisionRule(Shape shape, CollisionAction action, Action<Shape> method = null)
 {
     Type = CollisionRuleType.Shape;
     Target = shape;
     Action = action;
     Method = method;
 }
Esempio n. 2
0
        /// <summary>
        /// Draws the outline of a shape. Drawing filled shapes is (currently?) only possible for AABB's. See DrawFilledRect.
        /// </summary>
        public static void DrawShapeOutline(Shape shape, Color color, int depth = 0)
        {
            //add the start point at the end of the array so it will draw the last line
            Point[] shapePoints = shape.GetPoints();
            Point[] points = new Point[shapePoints.Length + 1];
            shapePoints.CopyTo(points, 0);
            points[points.Length - 1] = points[0];

            DrawJobs.Add(new LineDrawJob(depth, shape.GetEnclosingRectangle(), points, color));
        }