예제 #1
0
            public IEnumerator WHEN_FillAllGameDataFunctionCalled_THEN_GameDataIsFilled()
            {
                // Make all games labelled as played
                Globals.isBalloonsButtonOn     = false;
                Globals.isCTFButtonOn          = false;
                Globals.isImageHitButtonOn     = false;
                Globals.isSquaresButtonOn      = false;
                Globals.isCatchTheBallButtonOn = false;
                Globals.isJudgeTheBallButtonOn = false;
                Globals.isSaveOneBallButtonOn  = false;

                BatterySessionManagement batterySessionManagement = new BatterySessionManagement();

                batterySessionManagement.FillAllGameData();

                yield return(null);

                // Game data should be filled with actual gameplay data from each game
                Assert.AreEqual(Balloons.GetGameplayData(), batterySessionManagement.balloonsData);
                Assert.AreEqual(CatchTheThief.GetGameplayData(), batterySessionManagement.ctfData);
                Assert.AreEqual(Squares.GetGameplayData(), batterySessionManagement.squaresData);
                Assert.AreEqual(ImageHit.GetGameplayData(), batterySessionManagement.imageHitData);
                Assert.AreEqual(CatchTheBall.GetGameplayData(), batterySessionManagement.catchTheBallData);
                Assert.AreEqual(JudgeTheBall.GetGameplayData(), batterySessionManagement.judgeTheBallData);
                Assert.AreEqual(SaveOneBall.GetGameplayData(), batterySessionManagement.saveOneBallData);
            }
예제 #2
0
            public IEnumerator WHEN_GetGameplayDataFunctionCalledAtBeginning_THEN_EmptyGamePlayDataRetured()
            {
                // Test the storage right at the beginning of the game
                SquaresStorage actualSquaresStorage = Squares.GetGameplayData();

                yield return(null);

                List <SquaresRound> expectedSquaresStorage = new List <SquaresRound>();

                Assert.AreEqual(expectedSquaresStorage, actualSquaresStorage.Rounds);
            }
        /// <summary>
        /// FillAllGameData is to update game data objects with corresponding raw gameplay data.
        /// It will only get gameplay data for the games that have been played.
        /// </summary>
        public void FillAllGameData()
        {
            // Get gameplay data for Balloons
            // If the game has been played, get the gameplay data; else, skip this game
            if (!notYetPlayBalloons)
            {
                balloonsData = Balloons.GetGameplayData();
            }

            // Get gameplay data for Squares
            // If the game has been played, get the gameplay data; else, skip this game
            if (!notYetPlaySquares)
            {
                squaresData = Squares.GetGameplayData();
            }


            // Get gameplay data for Catch The Thief
            // If the game has been played, get the gameplay data; else, skip this game
            if (!notYetPlayCTF)
            {
                ctfData = CatchTheThief.GetGameplayData();
            }

            // Get gameplay data for ImageHit
            // If the game has been played, get the gameplay data; else, skip this game
            if (!notYetPlayImageHit)
            {
                imageHitData = ImageHit.GetGameplayData();
            }

            // Get gameplay data for Catch The Ball
            // If the game has been played, get the gameplay data; else, skip this game
            if (!notYetCatchTheBall)
            {
                catchTheBallData = CatchTheBall.GetGameplayData();
            }

            // Get gameplay data for Save One Ball
            // If the game has been played, get the gameplay data; else, skip this game
            if (!notYetSaveOneBall)
            {
                saveOneBallData = SaveOneBall.GetGameplayData();
            }

            // Get gameplay data for Judge The Ball
            // If the game has been played, get the gameplay data; else, skip this game
            if (!notYetJudgeTheBall)
            {
                judgeTheBallData = JudgeTheBall.GetGameplayData();
            }
        }
            public IEnumerator WHEN_EvaluateSquaresScoreFunctionCalledOnEmptyInput_SquareSubScoreReturnsBaseScore()
            {
                // Initialize the measurement module
                InitializeVisuospatialMeasure();

                // Call the evaluate score function
                VisuospatialSketchpadMeasure.EvaluateSquaresScore();

                yield return(null);

                // SquaresStorage datatype variable to hold the data from the squares mini-game
                SquaresStorage squaresData = Squares.GetGameplayData();

                // Ensure that SubscoreSquares values are correctly set
                Assert.AreEqual(AbilityName.VISUOSPATIAL_SKETCHPAD, VisuospatialSketchpadMeasure.subScoreSquares.AbilityName);
                Assert.AreEqual(GameName.SQUARES, VisuospatialSketchpadMeasure.subScoreSquares.GameName);
                Assert.AreEqual(0, VisuospatialSketchpadMeasure.subScoreSquares.Score);
                Assert.AreEqual(2, VisuospatialSketchpadMeasure.subScoreSquares.Weight);
            }
예제 #5
0
            public IEnumerator WHEN_GetGameplayDataFunctionCalled_THEN_GamePlayDataRetured()
            {
                // Wait for highlight sequence stage
                yield return(new WaitForSeconds(squareHighlightDuration * 3));

                yield return(new WaitForSeconds(0.02f));

                // Click on a square
                displayedSquares[1].GetComponent <Button>().onClick.Invoke();
                yield return(new WaitForSeconds(squareHighlightDuration));

                // End the round (And store information)
                doneButton.onClick.Invoke();
                yield return(new WaitForSeconds(0.01f));

                // Test the storage after round information is
                SquaresStorage actualSquaresStorage = Squares.GetGameplayData();

                List <IndexAndPosition> expectedRecalledSquares = new List <IndexAndPosition>();

                // The game object is displayedSquares
                Square     squareScript       = displayedSquares[1].GetComponent <Square>();
                Position2D expectedPosition2D = squareScript.Position;

                IndexAndPosition expectedIndexAndPosition = new IndexAndPosition(1, expectedPosition2D);

                expectedRecalledSquares.Add(expectedIndexAndPosition);
                double expectedRecallTime = squareHighlightDuration + 0.02;

                // Check that the information in the storage is correct
                Assert.AreEqual(3, actualSquaresStorage.Rounds[0].HighlightedSquares.Count);
                Assert.AreEqual(expectedRecalledSquares[0].Index, actualSquaresStorage.Rounds[0].RecalledSquares[0].Index);
                Assert.IsTrue(Math.Abs((expectedRecalledSquares[0].Position.X) - (actualSquaresStorage.Rounds[0].RecalledSquares[0].Position.X)) <= tolerance);
                Assert.IsTrue(Math.Abs((expectedRecalledSquares[0].Position.Y) - (actualSquaresStorage.Rounds[0].RecalledSquares[0].Position.Y)) <= tolerance);
                Assert.IsTrue(Math.Abs(actualSquaresStorage.Rounds[0].RecallTime - expectedRecallTime) <= tolerance);
                Assert.IsTrue(Math.Abs(squareHighlightInterval - actualSquaresStorage.Rounds[0].SquareHighlightInterval) <= tolerance);
                Assert.IsTrue(Math.Abs(squareHighlightDuration - actualSquaresStorage.Rounds[0].SquareHighlightDuration) <= tolerance);
            }