Example #1
0
 protected override void UpdateTarget()
 {
     base.UpdateTarget();
     if (NPCinfo.target == null)
     {
         if (CompareTag("Ally"))
         {
             TryNewTarget(NPCList.NearestAllEnemy(center));
         }
         if (CompareTag("Enemy"))
         {
             TryNewTarget(NPCList.NearestAllAlly(center));
         }
     }
     else if (NPCinfo.target.target != NPCinfo)
     {
         if (CompareTag("Ally"))
         {
             TryNewTarget(NPCList.NearestFreeEnemy(center));
         }
         if (CompareTag("Enemy"))
         {
             TryNewTarget(NPCList.NearestFreeAlly(center));
         }
     }
 }
Example #2
0
 protected override void UpdateTarget()
 {
     if (NPCinfo.target == null)
     {
         if (CompareTag("Ally"))
         {
             TryNewTarget(NPCList.NearestFreeEnemy(transform));
         }
         if (CompareTag("Enemy"))
         {
             TryNewTarget(NPCList.NearestFreeAlly(transform));
         }
     }
     base.UpdateTarget();
 }