void Update() { if (zombieInRange) { hp.TakeDamage(hp.currentHealth); } }
public void OnCollisionEnter(Collision collision) { if (collision.gameObject.tag == "Player") { playerHealth = collision.gameObject.GetComponent <CompleteProject.PlayerHealth>(); // If the player has health to lose... if (playerHealth.currentHealth > 0) { // ... damage the player. playerHealth.TakeDamage(damage); } } }
void Attack() { // Reset the timer. timer = 0f; // If the player has health to lose... if (!playerHealth.isDead) { // ... damage the player. playerHealth.TakeDamage(attackDamage); // Knock back player.transform.position = Vector3.MoveTowards(player.transform.position, transform.position + (transform.forward * 2.0f), 2.0f); } }
void Attack() { // Reset the timer. timer = 0f; // Set the player's animation controller to attack. anim.SetBool("Attack", true); // If the player has health to lose... if (playerHealth.currentHealth > 0) { // ... damage the player. playerHealth.TakeDamage(attackDamage); } }
void Attack() { // Reset the timer. timer = 0f; // If the player has health to lose... if (playerHealth.currentHealth > 0) { var damageBuff = GameManager.Manager.BuffManager.CreateBuff <Damage>(); damageBuff.Value = attackDamage; damageBuff.Maker = enemyHealth; damageBuff.Type = DamageType; playerHealth.TakeDamage(damageBuff); } }
void Attack() { // Reset the timer. timer = 0f; // If the player has health to lose... if (playerHealth.currentHealth > 0) { // ... damage the player. playerHealth.TakeDamage(attackDamage); arrowLine.enabled = true; arrowLine.SetPosition(0, transform.position); arrowLine.SetPosition(1, player.transform.position); } }
void Attack() { // Reset the timer. timer = 0f; // If the player has health to lose... if (playerHealth.currentHealth > 0) { playerHealth.TakeDamage(new Damage() { Value = attackDamage, Maker = enemyHealth, Type = DamageType }); } }
void Explode() { Collider[] collidersToDestroy = Physics.OverlapSphere(transform.position, 6, pLayerMask.value); foreach (Collider nearbyObject in collidersToDestroy) { EnemyHealth bodyZomb = nearbyObject.GetComponent <EnemyHealth>(); if (bodyZomb != null) { bodyZomb.TakeDamage(125, transform.position); } PlayerHealth bodyPlayer = nearbyObject.GetComponent <PlayerHealth>(); if (bodyPlayer != null && !bodyPlayer.isDead) { bodyPlayer.TakeDamage(125); } } }
void OnTriggerEnter(Collider other) { if (other.tag == "Boundary" || other.tag == "Enemy") { return; } if (explosion != null) { Instantiate(explosion, transform.position, transform.rotation); } if (other.tag == "Player") { Instantiate(playerExplosion, other.transform.position, other.transform.rotation); playerHealth.TakeDamage(10); } //gameController.AddScore(scoreValue); //this is here incase everything keeps blowing up. Destroy(other.gameObject); Destroy(gameObject); }
public void TakeDamage(int Damage) { HP.TakeDamage(Damage); }