void Awake() { player = GameObject.FindGameObjectWithTag("Player"); playerHealthHU = player.GetComponent <PlayerHealthHU> (); enemyHealthHU = GetComponent <EnemyHealthHU>(); anim = GetComponent <Animator> (); }
void Awake() { player = GameObject.FindGameObjectWithTag("Player").transform; playerHealthHU = player.GetComponent <PlayerHealthHU> (); enemyHealthHU = GetComponent <EnemyHealthHU> (); nav = GetComponent <NavMeshAgent>(); body = GetComponent <Rigidbody>(); }
private void OnTriggerEnter(Collider other) { if (other.transform.tag.Contains("Player")) { PlayerHealthHU playerHealthHU = other.gameObject.GetComponent <PlayerHealthHU>(); playerHealthHU.heal(amount); Destroy(gameObject); } }