public void InspectNearbyHumans() { // Debug.Log ("Running TestVision"); if (humanAttack.armed == HumanAttack.Armed.unarmed) { return; } else { for (int i = 0; i < nearbyHumans.Count; i++) { RaycastHit hit; Vector3 humanToTarget = nearbyHumans[i].transform.position - transform.position; Vector3 eyePos = new Vector3(transform.position.x, transform.position.y + eyeHeight, transform.position.z); // Create a vector from the enemy to the player and store the angle between it and forward. float enemyRelativeAngle = Vector3.Angle(humanToTarget, transform.forward); // If the angle between forward and where the player is, is less than half the angle of view... if (IsWithinFieldOfView(enemyRelativeAngle)) { if (Physics.Raycast(eyePos, humanToTarget, out hit, humanLayerMask) && hit.transform.CompareTag("human")) { HumanInfection.InfectionState otherInfection = hit.transform.GetComponent <HumanInfection>().infectionState; if (otherInfection != myInfection.infectionState && otherInfection != HumanInfection.InfectionState.Clean) { humanAttack.Shoot(eyePos, hit.point, hit.transform.GetComponent <HumanHealth>()); } } } } } }
public void ArmYourself(HumanInfection.InfectionState infectionState) { int alteredInfectionState = (int)infectionState - 1; if (alteredInfectionState < 0) { alteredInfectionState = 0; } meshRenderer.material = armedMats [alteredInfectionState]; }