// Ball vs Slice Collision public void UpdateSlicerCollision() { float ballSize = 1; if (Math2D.LineIntersectCircle(Slicer2DController.GetPair(), new Vector2D(transform.position), ballSize)) { ThinSliceGameManager.CreateParticles(); // Remove Current Slicing Process Slicer2DController.ClearPoints(); } }
// Triggered Before Every Slice // Should we perform slice? Is it succesful according our rules? bool OnSlice(Slice2D sliceResult) { Polygon2D CutObject = GetCutPolygon(sliceResult); // Forbidden double slices // Shouldn't be possible with linear slicer if (sliceResult.polygons.Count > 2) { return(false); } // Add Particles if slice is succesful if (CutObject == null) { ThinSliceGameManager.CreateParticles(); Slicer2DController.ClearPoints(); return(false); } return(true); }