After referencing numerous relevant scripts in a attempt to Frankestein my own to life I have hit a wall. My intention is to have the player affected by the health modifiers over time instead of an instance as it currently set. I believe it requires OnTriggerEnter and OnTriggerExit and possibly something to do with Time.deltatime?
Just starting out with Unity programming so please forgive my ignorance any help or insight would be greatly appreciated.
var playerHealth = 100;
function Update () {
if(playerHealth <= 0){
playerHealth = 0;
killPlayer();
}
function OnTriggerEnter (other : Collider){
if (other.gameObject.CompareTag("Black Orbit"))
{
playerHealth -= 2;
}
if (other.gameObject.CompareTag("White Orb"))
{
playerHealth += 1;
}}