Exemple #1
0
        public IEnumerator InventoryAudioPlayManaUseTest()
        {
            audio.PlayManaUse();
            yield return(new WaitForSecondsRealtime(0.05f));

            Assert.IsTrue(audio.Source.clip.name == "Использование зелья магии");
        }
Exemple #2
0
    /// <summary>
    /// Использование зелья
    /// </summary>
    public void OnPotionUse()
    {
        int index = GetSelectionIndex();

        if ((inventory.Items[index] as PotionItem).Count == 0)
        {
            return;
        }

        inventory.UsePotion(index);
        OnInventoryChanged();
        OnPotionCountChanged();

        if (index >= 0 && index < 3)
        {
            audio.PlayHealUse();
        }
        else if (index >= 3 && index < 6)
        {
            audio.PlayManaUse();
        }
        player.GetComponent <Player>().AddHealth((inventory.Items[index] as PotionItem).RefillValue);
    }