Exemple #1
0
    void WalkToClosestHuman()
    {
        RandomDude[] possibleHumans = allRandomDudes;
        RandomDude   closestHuman   = null;

        foreach (RandomDude possibleHuman in possibleHumans)
        {
            if (possibleHuman == null || possibleHuman.IsInfected())
            {
                continue;
            }

            if (!closestHuman ||
                Vector3.Distance(possibleHuman.transform.position, transform.position) < Vector3.Distance(closestHuman.transform.position, transform.position))
            {
                closestHuman = possibleHuman;
            }
        }

        Virologist virologist = FindObjectOfType <Virologist> ();

        if (closestHuman == null || Vector3.Distance(virologist.transform.position, transform.position) < Vector3.Distance(closestHuman.transform.position, transform.position))
        {
            agent.SetDestination(virologist.transform.position);
        }
        else
        {
            agent.SetDestination(closestHuman.transform.position);
        }
    }
Exemple #2
0
 void OnCollisionEnter(Collision c)
 {
     if (c.gameObject.GetComponent <RandomDude> ())
     {
         RandomDude dude = c.gameObject.GetComponent <RandomDude> ();
         if (dude.IsInfected())
         {
             return;
         }
         dude.TeleportToSafety();
     }
 }
Exemple #3
0
    void OnCollisionEnter(Collision c)
    {
        if (!this.IsInfected() || !c.gameObject.GetComponent <RandomDude> ())
        {
            return;
        }

        RandomDude other = c.gameObject.GetComponent <RandomDude> ();

        if (!other.IsInfected())
        {
            other.Infect();
            soundPlayer.PlayMinchingSound();
        }
        LookupPlaceOfInterest();
    }
Exemple #4
0
 void InfectPoorGuy(RandomDude other)
 {
     other.Infect();
 }