Some guys over on Reddit were asking for some example of the interface, so this might be of interest to some folk here too:
static void SliceAllSprites(Vector3 worldStartPoint, Vector3 worldEndPoint);
static void SliceAllSprites(Vector3 worldStartPoint, Vector3 worldEndPoint, bool destroySlicedObjects, ref List<SpriteSlicer2DSliceInfo> slicedObjectInfo);
static void SliceSprite(Vector3 worldStartPoint, Vector3 worldEndPoint, GameObject sprite);
static void SliceSprite(Vector3 worldStartPoint, Vector3 worldEndPoint, GameObject sprite, bool destroySlicedObjects, ref List<SpriteSlicer2DSliceInfo> slicedObjectInfo);
So you have the option of slicing any sprite that intersects the vector or you can pass through a specific gameobject if you know exactly what it is that you want to cut. The demo is using the first option, which is why you can get multiple things getting cut if you move the mouse fast enough.
SpriteSlicer2DSliceInfo is an optional parameter, which will get filled out with information on which slice generated which child objects from which parent object, so you can do any extra processing as required (eg. add particle effects at the cut positions, increment a score depending on what type of object the parent was)
The explosion code is as follows:
static void ExplodeSprite(GameObject sprite, int numCuts, float explosionForce);
static void ExplodeSprite(GameObject sprite, int numCuts, float explosionForce, bool destroySlicedObjects, ref List<SpriteSlicer2DSliceInfo> slicedObjectInfo);
It basically slices the object multiple times at random angles through the centre, and then applies an outward force to each child object away from the centre. I've got some ideas for improving this - specifically running a triangulation algorithm over the mesh and then creating the child objects from that. Should make a more pleasing shattering type effect with more evenly distributed polys (its a bit 'chunky' at the moment).