Esempio n. 1
0
        // Ball vs Slice Collision
        public void BallToSlicerCollision()
        {
            if (Math2D.Circle.IntersectLine(Slicer2DController.Get().linearControllerObject.GetPair(0).ToPair2D(), new Vector2D(transform.position), radius))
            {
                ThinSlicerParticles.Create();

                // Remove Current Slicing Process
                Slicer2DController.Get().complexControllerObject.pointsList[0].Clear();
            }
        }
Esempio n. 2
0
        // Triggered Before Every Slice
        // Should we perform slice? Is it succesful according our rules?
        bool OnSlice(Slice2D sliceResult)
        {
            Polygon2D CutObject = ThinSliceHelper.GetSmallestPolygon(sliceResult);

            // Forbidden double slices // Shouldn't be possible with linear slicer
            if (sliceResult.GetPolygons().Count > 2)
            {
                return(false);
            }

            // Add Particles if slice is succesful
            if (CutObject == null)
            {
                ThinSlicerParticles.Create();
                Slicer2DController.Get().complexControllerObject.pointsList[0].Clear();
                return(false);
            }

            return(true);
        }