コード例 #1
0
        public IEnumerator InventoryAudioPlayUnequipSwordTest()
        {
            yield return(new WaitForSecondsRealtime(2f));

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

            Assert.IsTrue(audio.Source.clip.name == "Сняли меч");
        }
コード例 #2
0
    /// <summary>
    /// Снимает вещь и перемещает ее в инвентарь,
    /// если есть свободные ячейки
    /// </summary>
    public void OnUnequip()
    {
        int index = GetSelectionIndex();
        var item  = inventory.Items[index];

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

        if (item is ArmorItem)
        {
            if (inventory.HasEmptyArmorSlot())
            {
                audio.PlayUnequipArmor();
            }
        }
        else if (item is WeaponItem)
        {
            if (inventory.HasEmptyWeaponSlot())
            {
                audio.PlayUnequipSword();
            }
        }
    }