private void ProcessHit(DamageDealer damageDealer) { if (damageDealer.CompareTag("Enemy")) { return; } if (damageDealer.CompareTag("EnemyShot")) { return; } meshRenderer.material = flashMaterial; gameController.AddToScore(scoreValue); health -= damageDealer.GetDamage(); agent.AddReward(0.01f); damageDealer.Hit(); if (health <= 0) { Die(); } else { Invoke("ResetMaterial", .1f); } }
private void ProcessHit(DamageDealer damageDealer) { if (damageDealer.CompareTag("Enemy")) { return; } if (damageDealer.CompareTag("EnemyShot")) { return; } if (damageDealer.CompareTag("Player")) { Instantiate(explosion, transform.position, transform.rotation); } health -= damageDealer.GetDamage(); damageDealer.Hit(); if (health <= 0) { gameController.AddToScore(scoreValue); Die(); } }
private void ProcessHit(DamageDealer damageDealer) { if (damageDealer.CompareTag("Enemy")) { return; } if (damageDealer.CompareTag("EnemyShot")) { return; } health -= damageDealer.GetDamage(); damageDealer.Hit(); if (health <= 0) { gameController.AddToScore(scoreValue); Die(); } }
public void OnTriggerEnter(Collider other) { DamageDealer damageDealer = other.gameObject.GetComponent <DamageDealer>(); if (!damageDealer) { return; } if (damageDealer.CompareTag("EnemyShot")) { //Debug.Log("Bolts collided"); damageDealer.Hit(); Destroy(gameObject); } }
private void ProcessHit(DamageDealer damageDealer) { if (damageDealer.CompareTag("PlayerShot")) { return; } damageSound.Play(); //meshRenderer.material = flashMaterial; health -= damageDealer.GetDamage(); healthDisplay.TakeDamage(1); // Subtracts one heart from the heartdisplay script agent.AddReward(-0.2f); damageDealer.Hit(); if (health <= 0) { Die(); } else { //Invoke("ResetMaterial", .1f); } }