Beispiel #1
0
    [UnityTest]     //ASSESSMENT4 ADDITION
    public IEnumerator MiniGameScene_LoadedWhenCurrentPlayerOwnsAndClicksThePVCSector()
    {
        yield return(LoadMainGame());         //Load the main game (TestScene)

        //Find the PVC sector and capture it as the current player.
        Game     game        = SceneManager.GetActiveScene().GetRootGameObjects() [0].GetComponent <Game> ();
        Landmark pvcLandmark = game.viceChancellorGameObj.GetComponent <Landmark> ();
        Sector   pvcSector   = pvcLandmark.gameObject.transform.parent.gameObject.GetComponent <Sector>();

        game.currentPlayer.units [0].MoveTo(pvcSector);

        //Once captured, when Landmark.OnMouseDown is called, the minigame scene should load.
        //Otherwise test will timeout after 30 seconds.
        pvcLandmark.OnMouseDown();
        yield return(new WaitUntil(() => SceneManager.GetSceneByName("miniGameScene").isLoaded));

        Assert.That(SceneManager.GetSceneByName("miniGameScene") == SceneManager.GetActiveScene());
    }