public static void ClearAffectedList() { foreach (GameObject go in AffectedParts) { go.GetComponent <ConnectionScanning>().enabled = false; go.GetComponent <MeshRenderer>().material = UnaffectedMat; go.GetComponent <PartBehaviour>().enabled = false; go.GetComponent <ConstantForce>().force = Vector3.zero; } FreeParts.AddRange(AffectedParts); AffectedParts.Clear(); }
public static void ClearAffectedList() { for (int i = AffectedParts.Count - 1; i >= 0; --i) { GameObject go = AffectedParts[i]; if (go == null) { AffectedParts.RemoveAt(i); continue; } go.GetComponent <ConnectionScanning>().enabled = false; go.GetComponent <MeshRenderer>().material = MaterialHolder.UnaffectedMat; go.GetComponent <PartBehaviour>().enabled = false; go.GetComponent <ConstantForce>().force = Vector3.zero; } FreeParts.AddRange(AffectedParts); AffectedParts.Clear(); }