コード例 #1
0
 public void playerHealing()
 {
     if (myHealthBar.value < currentMaxHealth)
     {
         GameObject newHealing = (GameObject)Instantiate(healingEffect, transform.position, Quaternion.identity);
         mana.manaHeal();
         Debug.Log("Current Max Health Value " + currentMaxHealth);
         myHealthBar.maxValue = currentMaxHealth;
         myHealthBar.value    = currentMaxHealth;
         Debug.Log("Current Health Bar Value is " + myHealthBar.value);
         Destroy(newHealing, 2);
         audioSource.PlayOneShot(healingSound);
     }
     else
     {
         Debug.Log("Health is already full!");
         myHealthBar.maxValue = currentMaxHealth;
         myHealthBar.value    = currentMaxHealth;
     }
 }