void PickUpItem() { FPSPlayer FPSPlayerComponent = playerObj.GetComponent <FPSPlayer>(); if (FPSPlayerComponent.hitPoints < FPSPlayerComponent.maximumHitPoints) { //heal player FPSPlayerComponent.SendMessage("HealPlayer", healthToAdd, SendMessageOptions.DontRequireReceiver); if (pickupSound) { AudioSource.PlayClipAtPoint(pickupSound, myTransform.position, 0.75f); } if (removeOnUse) { //remove this pickup Object.Destroy(gameObject); } } else { //player is already at max health, just play beep sound effect if (fullSound) { AudioSource.PlayClipAtPoint(fullSound, myTransform.position, 0.75f); } } }