private void SpawnRandomResource(Transform pos) { float v = Random.value; Collectable newCollectable; if (v > 0.1f) { newCollectable = Collectable.CreateAmmo(); } else if (v > 0.05f) { newCollectable = Collectable.CreateBomb(); } else { newCollectable = Collectable.CreateShield(); } newCollectable.gameObject.transform.position = pos.position; }