示例#1
0
    // Triggered Before Every Slice
    bool OnSlice(Slice2D sliceResult)
    {
        Polygon2D CutObject = GetCutPolygon(sliceResult);

        if (sliceResult.polygons.Count > 2)
        {
            return(false);             // Disallow double slices
        }

        if (SliceIntesectEdges(Slicer2DController.complexSlicerPointsList) == true)
        {
            ThinSliceGameManager.CreateParticles();
            Slicer2DController.complexSlicerPointsList.Clear();
            return(false);
        }

        if (CutObject == null)
        {
            ThinSliceGameManager.CreateParticles();
            Slicer2DController.complexSlicerPointsList.Clear();
            return(false);
        }

        return(true);
    }
示例#2
0
    void UpdateSlicerCollisions()
    {
        if (Math2D.SliceIntersectCircle(Slicer2DController.complexSlicerPointsList, new Vector2D(transform.position), 1f))
        {
            ThinSliceGameManager.CreateParticles();

            // Remove Current Slicing Process
            Slicer2DController.complexSlicerPointsList.Clear();
        }
    }
    // 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();
        }
    }
示例#4
0
    // 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);
    }