my script it is supposed to spawn an invisible portal on 0 playerhealth that takes me to dz_Default but nothing happens on 0 playerhealth
///
/// PlayerHealth.cs
/// Display the players health in game
///
/// Attach this class to your player character
///
using UnityEngine;
using System.Collections;
public class PlayerHealth : MonoBehaviour {
private const string DEFAULT_DROP_ZONE_NAME = "dz_Default";
public GameObject destination;
public int maxHealth = 100;
public int curHealth = 100;
public float healthBarLength;
// Use this for initialization
void Start () {
healthBarLength = Screen.width / 2;
}
// Update is called once per frame
void Update () {
AddjustCurrentHealth(0);
}
void OnGUI() {
GUI.Box(new Rect(10, 10, healthBarLength, 20), curHealth + "/" + maxHealth);
}
public void AddjustCurrentHealth(int adj) {
curHealth += adj;
if(curHealth < 0)
curHealth = 0;
if(curHealth > maxHealth)
curHealth = maxHealth;
if(maxHealth < 1)
maxHealth = 1;
if(curHealth <= 0)
{
destination = GameObject.Find( DEFAULT_DROP_ZONE_NAME );
}
healthBarLength = (Screen.width / 2) * (curHealth / (float)maxHealth);
}
public void OnTriggerEnter( Collider other ) {
if( other.transform.CompareTag("Player") )
other.transform.position = destination.transform.position;
}
}