void OnTriggerEnter(Collider other) { if (other.CompareTag("human")) { HumanInfection humanInfection = other.GetComponent <HumanInfection>(); if (humanInfection.infectionState != HumanInfection.InfectionState.Clean) { SelectAndGiveGun(other.GetComponent <HumanAttack>(), humanInfection); } } }
void Awake() { agent = GetComponent <NavMeshAgent>(); shopWaypoints = GameObject.FindGameObjectsWithTag("waypointShop"); catP1RedHumanTarget = GameObject.Find("catP1RedHumanTarget").GetComponent <Transform>(); catP2BluHumanTarget = GameObject.Find("catP2BluHumanTarget").GetComponent <Transform>(); catP3GrnHumanTarget = GameObject.Find("catP3GrnHumanTarget").GetComponent <Transform>(); humanInfection = GetComponent <HumanInfection>(); RandomDestination(); }
void SelectAndGiveGun(HumanAttack humanAttack, HumanInfection humanInfection) { humanAttack.ArmYourself(humanInfection.infectionState); if (humanAttack.armed == HumanAttack.Armed.unarmed) { AudioSource.PlayClipAtPoint(toolUp, Vector3.zero); int percent = Random.Range(0, 100); if (percent < percentUzi) { humanAttack.armed = HumanAttack.Armed.handgun; } if (percent > percentUzi && percent < percentGrenadeLauncher) { humanAttack.armed = HumanAttack.Armed.uzi; } if (percent > percentGrenadeLauncher) { humanAttack.armed = HumanAttack.Armed.grenadeLauncher; } } }
void Awake() { myInfection = GetComponent <HumanInfection>(); humanAttack = GetComponent <HumanAttack>(); halfFieldOfViewAngle = fieldOfViewAngle * 0.5f; }