public IEnumerator OnePass() { Cutscene nextScene = new Cutscene((passKitten, null), backgrounds[0]); 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>(); currentScene.show(); sNavi.setCurrentScene(currentScene); sNavi.addConditions(asset, new List <Conditional> { new HasBeenClicked(asset) }); 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(nextScene, sNavi.getCurrentScene()); }
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 ShowsBackground() { PointandClick currentScene = new PointandClick(assets, background); currentScene.show(); yield return(new WaitForSeconds(1f)); Texture currentBackground = GameObject .FindWithTag("BGPanelStatic") .GetComponent <RawImage>() .texture; Assert.AreEqual(background, currentBackground); }
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 ShowsAssets() { PointandClick currentScene = new PointandClick(assets); currentScene.show(); yield return(new WaitForSeconds(1f)); GameObject aPanel = GameObject.FindWithTag("AssetsPanel"); Transform asset = aPanel.transform.GetChild(0); Assert.AreEqual(assets[0].getPrefab().name, asset.name); Vector3 scenePosition = asset.position; Vector3 desiredPosition = assets[0].getPosition(); Assert.AreEqual(Math.Floor(desiredPosition.x), Math.Floor(scenePosition.x)); Assert.AreEqual(Math.Floor(desiredPosition.y), Math.Floor(scenePosition.y)); }
public IEnumerator CutsceneToPaC() { GameObject eventSystem = GameObject.FindWithTag("EventSystem"); DialogueViewer dlViewer = eventSystem.GetComponent <DialogueViewer>(); SceneNavigator sNavi = eventSystem.GetComponent <SceneNavigator>(); PointandClick secondScene = new PointandClick(assets1, backgrounds[0]); Cutscene firstScene = new Cutscene((kitten, cat), backgrounds[1], secondScene); sNavi.setCurrentScene(firstScene); firstScene.show(); yield return(new WaitUntil(() => dlViewer.getNavButton().getState().isClicked())); yield return(new WaitForSeconds(2f)); Assert.Inconclusive("Does the transition look smooth?"); }
public IEnumerator RemovesAssetsFromScene() { PointandClick currentScene = new PointandClick(assets); currentScene.show(); yield return(new WaitForSeconds(1f)); GameObject aPanel = GameObject.FindWithTag("AssetsPanel"); int numAssets = aPanel.transform.childCount; Assert.AreEqual(assets.Count, numAssets); currentScene.hide(); yield return(new WaitForSeconds(1f)); numAssets = aPanel.transform.childCount; Assert.AreEqual(0, numAssets); }
public IEnumerator PaCToCutscene() { DialogueViewer dlViewer = GameObject .FindWithTag("EventSystem") .GetComponent <DialogueViewer>(); Cutscene secondScene = new Cutscene((kitten, null), backgrounds[1]); PointandClick firstScene = new PointandClick(assets1, backgrounds[0]); firstScene.show(); yield return(new WaitForSeconds(2f)); firstScene.hide(); secondScene.show(); yield return(new WaitUntil(() => !dlViewer.getIsTyping())); yield return(new WaitForSeconds(1f)); Assert.Inconclusive("Does the transition look smooth?"); }
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 PaCToPaC() { List <Asset> assets2 = new List <Asset> { new Asset("CA [Kitten]", new Vector3(270, 132), new PaCElement(null)) }; PointandClick secondScene = new PointandClick(assets2, backgrounds[1]); PointandClick firstScene = new PointandClick(assets1, backgrounds[0]); firstScene.show(); yield return(new WaitForSeconds(2f)); firstScene.hide(); secondScene.show(); yield return(new WaitForSeconds(2f)); Assert.Inconclusive("Does the transition look smooth?"); }
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)); }