static public void CreateParticles() { Max2DParticles.CreateSliceParticles(Slicer2DController.complexSlicerPointsList); float size = 0.5f; Vector2 f = Slicer2DController.complexSlicerPointsList.First().vector; 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 = Slicer2DController.complexSlicerPointsList.Last().vector; 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; }
public static Max2DParticles CreateSliceParticles(List <Vector2D> slice) { GameObject newGameObject = new GameObject(); newGameObject.name = "Particles"; Max2DParticles particles = newGameObject.AddComponent <Max2DParticles>(); foreach (Pair2D line in Pair2D.GetList(slice, false)) { particles.lines.Add(new LineParticle(line)); } newGameObject.AddComponent <DestroyTimer>(); return(particles); }
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; }