public IEnumerator InventoryAudioPlayDropArmorTest() { game = MonoBehaviour.Instantiate(Resources.Load <GameObject>("Game")); yield return(new WaitForSecondsRealtime(1f)); audio = GameObject.Find("UI").GetComponent <InventoryAudio>(); yield return(new WaitForSecondsRealtime(1f)); audio.PlayDropArmor(); yield return(new WaitForSecondsRealtime(0.000001f)); Assert.IsTrue(audio.Source.clip.name == "Бросили доспехи"); }
public IEnumerator InventoryAudioPlayExitButtonTest() { game = MonoBehaviour.Instantiate(Resources.Load <GameObject>("Game")); yield return(new WaitForSecondsRealtime(1f)); audio = GameObject.Find("UI").GetComponent <InventoryAudio>(); yield return(new WaitForSecondsRealtime(1f)); audio.PlayExitButton(); yield return(new WaitForSecondsRealtime(0.001f)); Assert.IsTrue(audio.Source.clip.name == "Звук нажатия кнопки"); }
void Start() { audio = audioHolder.GetComponent <InventoryAudio>(); //определили инвентарь inventory = player.GetComponent <Inventory>(); //создали ячейки cells = new List <Image>(); foreach (Image image in GetComponentsInChildren <Image>()) { if (image.CompareTag("InventoryCell")) { cells.Add(image); } } //отключили пока инвентаря, так как он открывается по кнопке gameObject.SetActive(false); }