Exemplo n.º 1
0
 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>();
 }
Exemplo n.º 3
0
 private void OnTriggerEnter(Collider other)
 {
     if (other.transform.tag.Contains("Player"))
     {
         PlayerHealthHU playerHealthHU = other.gameObject.GetComponent <PlayerHealthHU>();
         playerHealthHU.heal(amount);
         Destroy(gameObject);
     }
 }