bool ComplexSlice(List <Vector2D> slice) { if (sliceJoints) { Slicer2D.Controller.Joints.ComplexSliceJoints(slice); } List <Slice2D> results = Slicing.ComplexSliceAll(slice, sliceLayer); bool result = false; foreach (Slice2D id in results) { if (id.GetGameObjects().Count > 0) { result = true; } eventHandler.Perform(id); } if (addForce == true) { foreach (Slice2D id in results) { AddForce.ComplexSlice(id, addForceAmount); } } return(result); }
public void Slice() { float timer = Time.realtimeSinceStartup; foreach (Transform t in transform) { Polygon2D poly = Polygon2DList.CreateFromGameObject(t.gameObject)[0].ToWorldSpace(t); Slicing.ComplexSliceAll(poly.pointsList, Layer.Create()); } Destroy(gameObject); Debug.Log(name + " in " + (Time.realtimeSinceStartup - timer) * 1000 + "ms"); }