Ejemplo n.º 1
0
        public IEnumerator InventoryAudioPlayEquipSwordTest()
        {
            game = MonoBehaviour.Instantiate(Resources.Load <GameObject>("Game"));
            yield return(new WaitForSecondsRealtime(1f));

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

            audio.PlayEquipSword();
            yield return(new WaitForSecondsRealtime(0.000001f));

            Assert.IsTrue(audio.Source.clip.name == "Надели меч");
        }
Ejemplo n.º 2
0
    /// <summary>
    /// Надеть предмет из инвентаря
    /// </summary>
    public void OnEquip()
    {
        int index = GetSelectionIndex();
        var item  = inventory.Items[index];

        inventory.ReplaceToEquipment(index);
        OnInventoryChanged();
        UIReset();

        if (item is ArmorItem)
        {
            audio.PlayEquipArmor();
        }
        else if (item is WeaponItem)
        {
            audio.PlayEquipSword();
        }
    }