void OnTriggerExit(Collider other) { var zone = other.GetComponent <StairZone>(); if (zone != null) { stairZone = null; } else { var haunt = other.GetComponent <Hauntable>(); if (haunt != null) { if (haunt.transform.position.z < transform.position.z) { // Foreground proxHaunts[0] = null; } else { // Background proxHaunts[1] = null; } } } }
void Start() { Height = transform.position.y; if (Upstairs != null) { upZone = Upstairs.GetComponent <StairZone>(); if (upZone != null) { upZone.downZone = this; } else { Debug.LogErrorFormat("Upstairs object on {0} must have a StairZone component", name); } } }