// Unit enters the range void OnTriggerEnter(Collider coll) { if (coll.gameObject.tag == "Unit") { targeting.Add(coll.gameObject); } }
void OnTriggerEnter(Collider col) { if (col.CompareTag("Unit")) { targeting.Add(col.gameObject); } }
void OnCollisionEnter(Collision col) { if (!col.gameObject.CompareTag("Unit")) { return; } targeting.Add(col.gameObject); }
// Unit enters the range void OnTriggerEnter(Collider coll) { if (coll.gameObject.tag == "Unit") { if (!coll.gameObject.GetComponent <UnitBase>().isSlowedDown) { targeting.Add(coll.gameObject); } } }
void OnTriggerEnter(Collider other) { GameObject target; Retarget retarget = other.GetComponent <Retarget>(); if (retarget != null) { target = retarget.target; } else { target = other.gameObject; } targeting.Add(target); GameObject toAttack = targeting.findClosestUnit(this.transform.position); baseScript.TargetEnemy(toAttack); }