Beispiel #1
0
        public IEnumerator InventoryAudioPlayHealUseTest()
        {
            game = MonoBehaviour.Instantiate(Resources.Load <GameObject>("Game"));
            yield return(new WaitForSecondsRealtime(1f));

            audio = GameObject.Find("UI").GetComponent <InventoryAudio>();
            audio.PlayHealUse();
            yield return(new WaitForSecondsRealtime(0.05f));

            Assert.IsTrue(audio.Source.clip.name == "Использвание зелья здоровья");
        }
Beispiel #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);
    }