protected MyTargets FindFromTargets(Transform t)
 {
     if (entityLL.Count > 0)
     {
         MyTargets target = null;
         foreach (MyTargets targets in entityLL)
         {
             if (targets.GetTransfrom() == t)
             {
                 target = targets;
                 break;
             }
         }
         if (target != null)
         {
             return(target);
         }
         else
         {
             Debug.LogError("The target being accessed is not present in entityLL");
         }
     }
     else
     {
         Debug.LogError("Size of entityLL is zero. Target couldn't be found");
     }
     return(null);
 }
Example #2
0
    private Transform ComputeHighPriorityTarget()
    {
        MyTargets priorityTarget = null;
        int       temp_priority  = 100;

        foreach (MyTargets t in entityLL)
        {
            int priority = target_priority[GameManager.Instance().GetDefenseType(t.GetTargetType())];
            if (priority < temp_priority)
            {
                temp_priority  = priority;
                priorityTarget = t;
            }
        }
        if (priorityTarget == null)
        {
            Debug.LogError("Priority Target couldn't be found and thus it is null");
        }
        return(priorityTarget.GetTransfrom());
    }