void Awake() { player = GameObject.FindGameObjectWithTag("Player"); playerHealth = player.GetComponent <PlayerHealth>(); docHealth = GetComponent <DoctorHealth>(); anim = GetComponent <Animator>(); }
void OnTriggerExit(Collider other) { if (other.gameObject == player) { playerInRange = false; } if (other.gameObject == doctor) { doctor = null; docHealth = null; docInRange = false; } }
void OnTriggerEnter(Collider other) { if (other.gameObject == player) { playerInRange = true; } if (other.gameObject.tag == "Doctor") { doctor = other.gameObject; docHealth = doctor.GetComponent <DoctorHealth>(); docInRange = true; } }
void Awake() { nav = gameObject.GetComponent <NavMeshAgent> (); NewTarget(); docHealth = GetComponent <DoctorHealth>(); }