void Shoot() { //Debug.Log("targetEnemy.tag: "+targetEnemy.tag); //if (targetEnemy.CompareTag("Enemy2")) { //} GameObject tiroObject = (GameObject)Instantiate(tiroPrefab, initTiro.position, initTiro.rotation); Tiro tiro = tiroObject.GetComponent <Tiro>(); if (tiro != null) { tiro.Procurar(target); } if (targetEnemy != null) { targetEnemy.TakeDamage(1); } if (targetEnemy2 != null) { targetEnemy2.TakeDamage(1); } }
void Shoot() { Debug.Log("ATIROU"); GameObject tiroObject = (GameObject)Instantiate(tiroPrefab, initTiro.position, initTiro.rotation); Tiro tiro = tiroObject.GetComponent <Tiro>(); if (tiro != null) { tiro.Procurar(target); } }