private void OnTriggerEnter2D(Collider2D collision) { if (collision.CompareTag("Player")) { GetComponent <Animator>().SetTrigger("Open"); if (cs.connectionLoss >= 5) { cs.connectionLoss -= 5; } while (ch == 0) { Instantiate(lootManager.GetRandomGear(), transform.position + (transform.up * 0.5f) + (transform.right * 0.5f), Quaternion.identity); Instantiate(lootManager.GetRandomBigConsumable(), transform.position + (transform.up * 0.5f) + (transform.right * 0.5f), Quaternion.identity); ch++; } // влияние на шкалу collider.enabled = false; Destroy(this); } }