private void OnCollisionEnter(Collision collision) { if (collision.transform.tag != "Player") { return; } switch (itemType) { case ItemType.Ammo: ItemManager.AmmoItem(collision.transform, Random.Range(minAmount, maxAmount)); break; case ItemType.Health: ItemManager.HealthItem(collision.transform, Random.Range(minAmount, maxAmount)); break; } parentSpawner.StartSpawningItem(); Destroy(gameObject); }