protected virtual IEnumerator RequestApplyIgnoreRopeCollision(bool p_force) { if (RopeParent != null && (NeedApplyIgnore || p_force)) { NeedApplyIgnore = false; List <Collider2D> v_selfColliders = new List <Collider2D>(this.GetNonMarkedComponentsInChildren <Collider2D>()); v_selfColliders.MergeList(new List <Collider2D>(this.GetNonMarkedComponentsInParent <Collider2D>(false, false))); List <GameObject> v_nodes = new List <GameObject>(RopeParent.Nodes); v_nodes.MergeList(RopeParent.GetPluggedObjectsInRope()); foreach (GameObject v_object in v_nodes) { if (v_object != null) { yield return(null); //Prevent Lags waiting one cycle to apply List <Collider2D> v_otherColliders = new List <Collider2D>(v_object.GetNonMarkedComponentsInChildren <Collider2D>()); v_otherColliders.MergeList(new List <Collider2D>(v_object.GetNonMarkedComponentsInParent <Collider2D>(false, false))); foreach (Collider2D v_selfCollider in v_selfColliders) { if (v_selfCollider != null && v_selfCollider.GetInstanceID() != 0) { foreach (Collider2D v_otherCollider in v_otherColliders) { if (v_otherCollider != null && v_otherCollider.GetInstanceID() != 0) { Physics2D.IgnoreCollision(v_selfCollider, v_otherCollider); } } } } } } } }
public bool Cut() { if (RopeParent != null) { return(RopeParent.CutNode(this.gameObject)); } else { DestroyUtils.DestroyImmediate(this.gameObject); } return(true); }