// 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();
        }
    }
Example #2
0
    static public void CreateParticles()
    {
        if (Slicer2DController.instance.startedSlice == false)
        {
            return;
        }

        List <Vector2D> points = Slicer2DController.GetLinearVertices(Slicer2DController.GetPair(), Slicer2DController.instance.minVertexDistance);

        if (points.Count < 3)
        {
            return;
        }

        Max2DParticles.CreateSliceParticles(points);

        float   size = 0.5f;
        Vector2 f    = points.First().ToVector2();

        f.x -= size / 2;
        f.y -= size / 2;

        List <Vector2D> list = new List <Vector2D>();

        list.Add(new Vector2D(f.x, f.y));
        list.Add(new Vector2D(f.x + size, f.y));
        list.Add(new Vector2D(f.x + size, f.y + size));
        list.Add(new Vector2D(f.x, f.y + size));
        list.Add(new Vector2D(f.x, f.y));

        Max2DParticles.CreateSliceParticles(list).stripped = false;

        f    = points.Last().ToVector2();
        f.x -= size / 2;
        f.y -= size / 2;

        list = new List <Vector2D>();
        list.Add(new Vector2D(f.x, f.y));
        list.Add(new Vector2D(f.x + size, f.y));
        list.Add(new Vector2D(f.x + size, f.y + size));
        list.Add(new Vector2D(f.x, f.y + size));
        list.Add(new Vector2D(f.x, f.y));

        Max2DParticles.CreateSliceParticles(list).stripped = false;
    }