private IEnumerator TestCase() { CaseOpen = false; yield return(new WaitForSeconds(1)); bool Good = true; foreach (GameObject a in Items) { if (!a) { Items.Remove(a); } } foreach (GameObject a in Items) { //проверяем у каждого ли предмета хватает ячеек if (!(a.GetComponent <Item>().Places.Count >= a.GetComponent <Item>().PlacesCountNeeded) && !a.GetComponent <Item>().Unmovable) { Good = false; if (a.GetComponent <Item>().Place) { Instantiate(ErrorPrefab, a.transform.position, a.transform.rotation, a.GetComponent <Item>().Place.transform); } else { Instantiate(ErrorPrefab, a.transform.position, a.transform.rotation); } } //проверям на пересечение с другими предметами foreach (Collider b in a.GetComponent <Item>().Colliders) { if (!b) { a.GetComponent <Item>().Colliders.Remove(b); } } if (a.GetComponent <Item>().Colliders.Count != 0) { Good = false; Instantiate(ErrorPrefab, a.transform.position, a.transform.rotation, a.GetComponent <Item>().Place.transform); } } if (!Good) { CaseOpen = true; CloseCaseButton.SetActive(true); } else { Packing = false; StartCoroutine(GameClients.Restart(false)); } }