private void OnTriggerEnter(Collider other) { NaveIA nia = other.GetComponent <NaveIA>(); if (nia != null) { if (nia.bando != bando) { nia.CausarDaño(daño); } } }
private void OnTriggerEnter(Collider other) { NaveIA nia = other.GetComponent <NaveIA>(); if (nia != null) { if (nia.bando != bando) { objetivo = other.gameObject; } } }
void MirarEnemigo() { Collider[] cols = Physics.OverlapSphere(transform.position, rangoEnemigos); for (int i = 0; i < cols.Length; i++) { NaveIA nia = cols[i].gameObject.GetComponent <NaveIA>(); if (nia != null) { if (nia.bando != bando) { objetivo = cols[i].transform; return; } } } }