// Update is called once per frame void Update() { played = CompleteMetalGame.checkSuccess(); if (played) { if (showIcon) { animation.Play("wellDone"); successSource.Play(); showIcon = false; } Invoke("nextScene", 1); } }
// Test for play WellDone animation & audio, and check if game is success when all items are removed public IEnumerator testPlayWellDone() { items = GameObject.FindGameObjectsWithTag("item"); wellDone = GameObject.Find("wellDone"); wellDone.GetComponent <AudioSource> ().volume = 0; // mute the audioSouce foreach (GameObject obj in items) { obj.GetComponent <DragItem> ().Invoke("OnMouseUp", 0); } ; yield return(new WaitForSeconds(0.5f)); Assert.IsTrue(CompleteMetalGame.checkSuccess()); Assert.IsTrue(wellDone.GetComponent <Animation> ().IsPlaying("wellDone")); Assert.IsTrue(wellDone.GetComponent <AudioSource> ().isPlaying); yield return(null); }