public IEnumerator HasBeenClickedConditionalPass() { Asset kitten = new Asset("CP [Kitten]", new Vector3(0, 0), new Character("Kitten", "Meow")); Cutscene dummyScene = new Cutscene( (kitten, null), Resources.Load <Texture>("Images/BG/Trees")); assets[0].getState().setNextScene(dummyScene); PointandClick currentScene = new PointandClick(assets); currentScene.show(); SceneNavigator.Instance.setCurrentScene(currentScene); yield return(new WaitForSeconds(1f)); GameObject aPanel = GameObject.FindWithTag("AssetsPanel"); AssetViewer aViewer = GameObject .FindWithTag("EventSystem") .GetComponent <AssetViewer>(); Asset asset = aViewer.getSceneAssetFrom(aPanel.transform.GetChild(0).gameObject); asset.getState().Click(asset); Assert.IsTrue(asset.getState().isClicked()); HasBeenClicked clickedConditional = new HasBeenClicked(asset); Assert.IsTrue(clickedConditional.isMet()); }
public IEnumerator OneFail() { Asset failKitten = new Asset("CP [Kitten]", new Vector3(0, 0), new Character("Kitten", "We're missing an important item.")); Cutscene nextScene = new Cutscene((passKitten, null), backgrounds[0]); Cutscene errorScene = new Cutscene((failKitten, null), backgrounds[1]); Asset asset = new Asset(assetName, assetPosition, new PaCElement(nextScene)); PointandClick currentScene = new PointandClick(new List <Asset> { asset }, backgrounds[1]); GameObject aPanel = GameObject.FindWithTag("AssetsPanel"); GameObject eventSystem = GameObject.FindWithTag("EventSystem"); SceneNavigator sNavi = eventSystem.GetComponent <SceneNavigator>(); AssetViewer aViewer = eventSystem.GetComponent <AssetViewer>(); DialogueViewer dlViewer = eventSystem.GetComponent <DialogueViewer>(); currentScene.show(); sNavi.setCurrentScene(currentScene); HasBeenClicked clickedCondition = new HasBeenClicked(asset); List <Conditional> conditionals = new List <Conditional> { clickedCondition }; sNavi.addConditions(asset, conditionals); sNavi.addErrorScene(asset, clickedCondition, errorScene); yield return(new WaitForSeconds(1f)); sNavi.changeSceneIfSatisfied(aViewer.getSceneAssetFrom(aPanel.transform.GetChild(0).gameObject)); yield return(new WaitForSeconds(3f)); Assert.AreEqual(errorScene, sNavi.getCurrentScene()); Asset navButton = dlViewer.getNavButton(); navButton.getState().Click(navButton); Assert.AreEqual(currentScene, sNavi.getCurrentScene()); yield return(new WaitForSeconds(3f)); }
public IEnumerator HasBeenClickedConditionalFail() { PointandClick currentScene = new PointandClick(assets); currentScene.show(); yield return(new WaitForSeconds(1f)); GameObject aPanel = GameObject.FindWithTag("AssetsPanel"); AssetViewer aViewer = GameObject .FindWithTag("EventSystem") .GetComponent <AssetViewer>(); Asset asset = aViewer.getSceneAssetFrom(aPanel.transform.GetChild(0).gameObject); Assert.IsFalse(asset.getState().isClicked()); HasBeenClicked clickedConditional = new HasBeenClicked(asset); Assert.IsFalse(clickedConditional.isMet()); }
public IEnumerator OnePassOneFail() { Asset e1kitten = new Asset("CP [Kitten]", new Vector3(0, 0), new Character("Kitten", "I should not be here.")); Asset e2kitten = new Asset("CP [Kitten]", new Vector3(50, 0), new Character("Kitten", "Oops!")); List <Cutscene> errorScenes = new List <Cutscene> { new Cutscene((e1kitten, null), backgrounds[1]), new Cutscene((e2kitten, null), backgrounds[1]) }; Asset passingAsset = new Asset( assetName, assetPosition, new PaCElement(null)); Asset placeholderAsset = new Asset( assetName, new Vector3(275, 147), new PaCElement(null)); List <Asset> assets = new List <Asset>() { passingAsset, placeholderAsset }; PointandClick currentScene = new PointandClick(assets, backgrounds[1]); GameObject aPanel = GameObject.FindWithTag("AssetsPanel"); GameObject eventSystem = GameObject.FindWithTag("EventSystem"); SceneNavigator sNavi = eventSystem.GetComponent <SceneNavigator>(); AssetViewer aViewer = eventSystem.GetComponent <AssetViewer>(); DialogueViewer dlViewer = eventSystem.GetComponent <DialogueViewer>(); currentScene.show(); sNavi.setCurrentScene(currentScene); HasBeenClicked passingCondition = new HasBeenClicked(passingAsset); HasBeenClicked failingCondition = new HasBeenClicked(placeholderAsset); List <Conditional> conditionals = new List <Conditional> { passingCondition, failingCondition }; sNavi.addConditions(passingAsset, conditionals); sNavi.addErrorScene(passingAsset, passingCondition, errorScenes[0]); sNavi.addErrorScene(passingAsset, failingCondition, errorScenes[1]); yield return(new WaitForSeconds(1f)); Asset sceneAsset = aViewer.getSceneAssetFrom(aPanel.transform.GetChild(0).gameObject); sceneAsset.getState().Click(sceneAsset); yield return(new WaitForSeconds(3f)); Assert.AreEqual(errorScenes[1], sNavi.getCurrentScene()); Asset navButton = dlViewer.getNavButton(); navButton.getState().Click(navButton); Assert.AreEqual(currentScene, sNavi.getCurrentScene()); yield return(new WaitForSeconds(3f)); }