예제 #1
0
 void AttackPlayer()
 {
     timer = 0f; // Resetting timer so Enemy may damage player again
     if (playerHealth.currentHealth > 0)
     {
         playerHealth.DamagePlayer(attackAmt); // calling DamagePlayer function in "PlayerHealthAndDeathManager" and inputting enemy attackAmount.
     }
 }
예제 #2
0
    protected virtual void Hit(GameObject hit)
    {
        PlayerHealthAndDeathManager healthManager = hit.gameObject.GetComponent <PlayerHealthAndDeathManager>();

        if (healthManager != null)
        {
            healthManager.DamagePlayer(damage);
        }
        Destroy(gameObject);
    }