Esempio n. 1
0
    public HuntedTarget Scan()
    {
        int          highestPriority = -1;
        HuntedTarget bestTarget      = null;

        //print("Scanning");

        foreach (HuntedTarget t in GameObject.FindObjectsOfType <HuntedTarget>())
        {
            //print(t.IsValidTarget());
            if (!t.IsValidTarget())
            {
                continue;
            }
            if (Vector3.Distance(t.transform.position, transform.position) > sightRange)
            {
                continue;
            }
            RaycastHit hit;
            if (Physics.Raycast(t.transform.position, transform.position - t.transform.position, out hit, sightRange))
            {
                if (hit.collider.gameObject == gameObject)
                {
                    if (t.GetPriority() > highestPriority)
                    {
                        highestPriority = t.GetPriority();
                        bestTarget      = t;
                    }
                }
            }
        }
        return(bestTarget);
    }
Esempio n. 2
0
 //------------------------------------------------------------
 // determines if there is a transmitter to attack
 //------------------------------------------------------------
 bool AssessHostile()
 {
     if (killConfirmTimer > 0f)
     {
         return(true);
     }
     target = eyes.Scan();
     return(target != null && target.IsValidTarget());
 }
Esempio n. 3
0
 //------------------------------------------------------------
 // responds to the hunted script as to whether this has already been broken
 //------------------------------------------------------------
 public void IsHuntable(HuntedTarget ht)
 {
     //print("Broken: " + broken + " / Start: " + isStartTransmitter);
     ht.SetValidTarget(!broken && !isStartTransmitter);
 }