public void checkConnections() { if (stickyTop > 0 || stickyBottom > 0) { //set all connected to false FraggedChild frag = null; for (int i = stickyTop; i < meshFilters.Length; i++) { frag = meshFilters[i].GetComponent <FraggedChild>(); frag.connected = false; } //checks connections upwards for (int j = stickyTop; j < meshFilters.Length; j++) { frag.checkConnections(); frag = meshFilters[j].GetComponent <FraggedChild>(); } // checks connections down for (int u = meshFilters.Length - stickyBottom - 1; u >= stickyTop; u--) { frag = meshFilters[u].GetComponent <FraggedChild>(); if (!frag.fragged) { frag.checkConnections(); if (!frag.connected) { frag.fragMe(2.0f); } } } } }
public void FragAll() { for (int i = fragments.transform.childCount; i > 0; i--) { FraggedChild child = fragments.GetChild(i - 1).GetComponent <FraggedChild>(); child.fragMe(200.0f); } }