void Awake() { gun = GetComponentInChildren <RangedWeapon>(); myHealth = GetComponentInParent <HumanHealth>(); HumanHealth.OnHumanDied += HumanHealth_OnHumanDied; PlayerPhysicalMovement.OnCollidedWithSomething += PlayerPhysicalMovement_OnCollidedWithSomething; }
void HumanHealth_OnHumanDied(HumanHealth e) { if (e == myHealth) { gun.DisableEffects(); } }
void OnTriggerEnter(Collider other) { if (other.gameObject.tag != "Human") { victim = other.gameObject; Walker walker = victim.GetComponent <Walker>(); if (walker != null) { walker.TakeDamage(Damage, pointOfOrigin); GameObject.Destroy(this.gameObject); } else { HumanHealth human = victim.GetComponent <HumanHealth>(); if (human != null) { human.TakeDamage(Damage); GameObject.Destroy(this.gameObject); } else { DoorHealth door = victim.GetComponent <DoorHealth>(); if (door != null) { door.TakeDamage(1); } GameObject.Destroy(this.gameObject); } } } }
void Awake() // Вообще говоря, безоружный человек должен пытаться убежать { myHealth = GetComponentInParent <HumanHealth>(); gun = GetComponentInChildren <RangedWeapon>(); HumanHealth.OnHumanDied += HumanHealth_OnHumanDied; Walker.OnWalkerDied += Walker_OnWalkerDied; }
void Human_OnHumanDied(HumanHealth e) { if (e.Infected) { StartCoroutine(Spawn(e.transform.position)); } }
public void Shoot(Vector3 eyePos, Vector3 target, HumanHealth humanHealth) { switch (armed) { case Armed.unarmed: Debug.LogWarning("How in the holy hell is this triggering? Should not be able to reach unarmed in this script!"); break; case Armed.handgun: // Debug.Log ("Firing handgun! Bang! Bang!"); TracerPool.instance.PlaceTracer(eyePos, target); humanHealth.TakeDamage(damageHandGun); break; case Armed.uzi: // Debug.Log ("Firing uzi! BRRRRAAAPPP!"); StartCoroutine(UziBurst(eyePos, target)); humanHealth.TakeDamage(damageUzi); break; case Armed.grenadeLauncher: if (canFireGrenadeLauncher) { // Debug.Log ("Firing grenade launcher! Ponk... BABOOOM!"); canFireGrenadeLauncher = false; StartCoroutine(GrenadeAndReload()); } break; } }
// Start is called before the first frame update void Start() { animator = GetComponent <Animator>(); safeZone = GameObject.Find("Safe Zone").transform; health = GetComponent <HumanHealth>(); navMeshAgent = GetComponent <NavMeshAgent>(); speed = navMeshAgent.speed; }
void HumanHealth_OnHumanDied(HumanHealth e) { HumanTargets.Remove(e.gameObject.GetComponentInChildren <PlayerPhysicalMovement>().gameObject); // ад if (e.gameObject.GetComponentInChildren <PlayerPhysicalMovement>().gameObject == Target) { Target = null; SpottedSomething = false; } }
// Use this for initialization void Awake() { HumanGunReloader.OnStartedToReload += HumanGunReloader_OnStartedToReload; HumanGunReloader.OnReloaded += HumanGunReloader_OnReloaded; PlayerShooting.OnPickedUpGun += PlayerShooting_OnPickedUpGun; playerHealth = Player.GetComponentInChildren <HumanHealth>(); playersGun = Player.GetComponentInChildren <RangedWeapon>(); playersReloader = Player.GetComponentInChildren <HumanGunReloader>(); backpack = Player.GetComponentInChildren <HumanBackpack>(); }
private void Start() { catTrans = GameManager.Instance.Cat.transform; catMeow = catTrans.GetComponent <CatMeow>(); humanHealth = GameManager.Instance.Human.GetComponent <HumanHealth>(); InitEnemies(); enemiesToMove = 0; }
void Attack(HumanHealth humanTarget) { // Reset the timer. timer = 0f; // If the player has health to lose... if (humanTarget.currentHealth > 0) { // ... damage the player. humanTarget.Infected = true; humanTarget.TakeDamage(attackDamage); } }
private void OnTriggerEnter(Collider other) { if (other.gameObject.CompareTag("Human")) { HumanHealth humanHealth = other.gameObject.GetComponent <HumanHealth>(); if (humanHealth.state.Equals(HumanState.Live)) { audioSource.Stop(); audioSource.Play(); // Debug.Log("Increase points"); hud.UpdateScore(pointsWorth); Destroy(other.gameObject, 2); } } }
public void Shoot(float inaccuracy, int shotsAtOnce, float range, int damagePerShot) { gunLine.SetVertexCount(shotsAtOnce * 2); gunLine.enabled = true; int j = 0; for (int i = 0; i < shotsAtOnce; i++) { gunLine.SetPosition(j, transform.position); j++; shootRay.origin = transform.position; shootRay.direction = new Vector3(transform.up.x + Random.Range(-inaccuracy, inaccuracy), transform.up.y, transform.up.z + Random.Range(-inaccuracy, inaccuracy)); if (Physics.Raycast(shootRay, out shootHit, range, shootableMask)) { victim = shootHit.collider.gameObject; Walker walker = victim.GetComponent <Walker> (); if (walker != null) { walker.TakeDamage(damagePerShot, transform.position); } else { HumanHealth human = victim.GetComponent <HumanHealth> (); if (human != null) { human.TakeDamage(damagePerShot); } else { DoorHealth door = victim.GetComponent <DoorHealth> (); if (door != null) { door.TakeDamage(1); } } } gunLine.SetPosition(j, shootHit.point); } else { gunLine.SetPosition(j, shootRay.origin + shootRay.direction * range); } j++; } }
private void OnTriggerEnter(Collider other) { if (other.gameObject.CompareTag("Player")) { attackingPlayer = true; coolDownTimer.Run(); playerInRange = true; } else if (other.gameObject.CompareTag("Human")) { playerInRange = false; attackingPlayer = false; // other.gameObject.GetComponent<HumanMovement>().DecreaseVelocity(0.75f); humanHealth = other.gameObject.GetComponent <HumanHealth>(); } }
// Start is called before the first frame update void Start() { EventsManager.onRunAfterSpeedUpdate += UpdateRunAfterSpeed; human = GetComponent <Human>(); humanHealth = GetComponent <HumanHealth>(); humanPoisoner = GetComponent <HumanPoisoner>(); agent = GetComponent <NavMeshAgent>(); _activeBorder = human.GetActiveBorders(); initialRunAfterSpeed = human.GetPropertie(Constants.PropertiesTypes.RunAfterSpeed); runAfterSpeed = initialRunAfterSpeed; UpdateHumanAgentSpeed(Constants.SpeedTypes.WalkSpeed); if (!agent.isOnNavMesh) { transform.position = _activeBorder.RightBorder.position - Vector3.right * 3; agent.enabled = false; agent.enabled = true; } }
void HumanHealth_OnHumanDied(HumanHealth e) { target = GameObject.FindGameObjectWithTag("Follower").transform; }