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); } }
void OnCollisionEnter(Collision c) { if (c.gameObject.GetComponent <RandomDude> ()) { RandomDude dude = c.gameObject.GetComponent <RandomDude> (); if (dude.IsInfected()) { return; } dude.TeleportToSafety(); } }
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(); }
void InfectPoorGuy(RandomDude other) { other.Infect(); }