コード例 #1
0
 public void DealDamage(float damageAmount)
 {
     _level01Controller.ResetMultiplier();
     if (currentPlayerHealth > 0 && currentPlayerHealth > damageAmount)
     {
         currentPlayerHealth -= damageAmount;
         _healthText.text     = currentPlayerHealth + " / " + maxPlayerHealth;
         AudioHelper.PlayClip2D(_playerDamaged, 1f);
     }
     else
     {
         currentPlayerHealth = 0;
         _healthText.text    = currentPlayerHealth + " / " + maxPlayerHealth;
     }
     _healthBar.value = currentPlayerHealth;
     if (currentPlayerHealth == 0)
     {
         Debug.Log("Player has Died.");
         InvertPausedBool();
         _mouseLook.InvertPausedBool();
         AudioHelper.PlayClip2D(_playerDeath, 1f);
         _level01Controller.PlayerDeath();
     }
 }