Beispiel #1
0
 // Unit enters the range
 void OnTriggerEnter(Collider coll)
 {
     if (coll.gameObject.tag == "Unit")
     {
         targeting.Add(coll.gameObject);
     }
 }
Beispiel #2
0
 void OnTriggerEnter(Collider col)
 {
     if (col.CompareTag("Unit"))
     {
         targeting.Add(col.gameObject);
     }
 }
Beispiel #3
0
    void OnCollisionEnter(Collision col)
    {
        if (!col.gameObject.CompareTag("Unit"))
        {
            return;
        }

        targeting.Add(col.gameObject);
    }
Beispiel #4
0
 // Unit enters the range
 void OnTriggerEnter(Collider coll)
 {
     if (coll.gameObject.tag == "Unit")
     {
         if (!coll.gameObject.GetComponent <UnitBase>().isSlowedDown)
         {
             targeting.Add(coll.gameObject);
         }
     }
 }
Beispiel #5
0
    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);
    }