void OnCollisionEnter(Collision c) { if (c.gameObject.layer == LayerMask.NameToLayer("Collectable")) { Collectable collectable = c.gameObject.GetComponent <Collectable>(); if ((int)collectable.data.collectableType == 0) { playerCoins += 1; playerSound.PlayCollectableSound(0); UIManager.instance.UpdateCoins(); } else if ((int)collectable.data.collectableType == 1) { damageable.Heal(1); playerSound.PlayCollectableSound(1); UIManager.instance.UpdateLife(); } else if ((int)collectable.data.collectableType == 2) { playerMove.Boost(); playerSound.PlayCollectableSound(2); } collectable.grab(); } }