public IEnumerator TestCatchTheThiefKeysPressedSetter()
            {
                round = new CatchTheThiefRound();
                round.UnidentifiedKeysPressed = new List <TimeAndKey>();
                int expectedListSize = 0;

                yield return(null);

                Assert.IsTrue(round.UnidentifiedKeysPressed.Count == expectedListSize);
            }
Example #2
0
            public IEnumerator WHEN_ClickCatchTheThief_THEN_ResponseTimeRecoreded()
            {
                yield return(null);

                CatchTheThiefRound catchTheThiefRound = new CatchTheThiefRound();

                catchTheThiefRound.identifiedKeyPressTime = 10;

                Assert.AreEqual(10, catchTheThiefRound.identifiedKeyPressTime);
            }
            public IEnumerator TestCatchTheThiefKeysPressedAdd1ItemThenListHas1Item()
            {
                round = new CatchTheThiefRound();
                round.UnidentifiedKeysPressed = new List <TimeAndKey>();
                round.UnidentifiedKeysPressed.Add(new TimeAndKey(1f, KeyCode.Alpha0));
                int expectedListSize = 1;

                yield return(null);

                Assert.IsTrue(round.UnidentifiedKeysPressed.Count == expectedListSize);
            }
            public IEnumerator WHEN_PersonAppearInRoundSet_THEN_CatchTheThiefGetsPersonAppearInRoundValue()
            {
                round = new CatchTheThiefRound();
                round.PersonAppearInRound = true; // float value

                bool PersonAppearInRound = true;

                yield return(null);

                Assert.IsTrue(PersonAppearInRound == round.PersonAppearInRound);
            }
            public IEnumerator WHEN_KeyPressTimeSet_THEN_CatchTheThiefGetsKeyPressTimeValue()
            {
                round = new CatchTheThiefRound();
                round.identifiedKeyPressTime = 7f; // float value

                float expectedHighlightInterval = 7f;

                yield return(null);

                Assert.IsTrue(expectedHighlightInterval == round.identifiedKeyPressTime);
            }
            public IEnumerator TestCatchTheThiefRoundGetterIsKeyPressedValue()
            {
                round = new CatchTheThiefRound();
                round.IsIdentifiedKeyPressed = false;

                bool ispressed = false;

                yield return(null);

                Assert.IsTrue(ispressed == round.IsIdentifiedKeyPressed, "CatchTheThiefIsKeyPressed getter returning incorrect value: " + ispressed + " , " + round.IsIdentifiedKeyPressed);
            }
            public IEnumerator TestCatchTheThiefKeysPressedAdd1ItemThenGetterReturnsCorrectValue()
            {
                round = new CatchTheThiefRound();
                round.UnidentifiedKeysPressed = new List <TimeAndKey>();
                TimeAndKey expectedTimeAndKey = new TimeAndKey(1f, KeyCode.Alpha0);

                round.UnidentifiedKeysPressed.Add(expectedTimeAndKey);
                TimeAndKey actualTimeAndKey = round.UnidentifiedKeysPressed[0];

                yield return(null);

                Assert.IsTrue(expectedTimeAndKey == actualTimeAndKey);
            }
Example #8
0
            public IEnumerator WHEN_EvaluateCTFScore()
            {
                ClearSelectiveVisualMeasure();
                yield return(null);

                SelectiveVisualMeasure.ctfData.Rounds = new List <CatchTheThiefRound>();
                CatchTheThiefRound catchTheThiefRound = new CatchTheThiefRound();

                catchTheThiefRound.ThiefAppearInRound     = true;
                catchTheThiefRound.IsIdentifiedKeyPressed = false;
                catchTheThiefRound.PersonAppearInRound    = false;
                SelectiveVisualMeasure.ctfData.Rounds.Add(catchTheThiefRound);

                SelectiveVisualMeasure.EvaluateCTFScore();
                Assert.AreEqual(AbilityName.SELECTIVE_VISUAL, SelectiveVisualMeasure.subScoreCTF.AbilityName);
                Assert.AreEqual(GameName.CATCH_THE_THIEF, SelectiveVisualMeasure.subScoreCTF.GameName);
                Assert.AreEqual(0, SelectiveVisualMeasure.subScoreCTF.Score);
                Assert.AreEqual(2, SelectiveVisualMeasure.subScoreCTF.Weight);
            }
        /// <summary>
        /// Reset or Calculate the level variables for the next round.
        /// </summary>
        private IEnumerator PrepareRound()
        {
            // Initialize round gameplay data variables
            roundNumber           += 1;
            identifiedKeyPressTime = 0;
            isRoundOver            = false;
            isIdentifiedKeyPressed = false;
            // In each round there is a new image order
            imageOrder = new List <Images>();

            // Decrease round duration as the number of rounds increase, until it reaches the minimum
            // round duration time
            if (roundDuration > MIN_ROUND_TIME)
            {
                roundDuration -= ROUND_TIME_DECREMENT;
            }

            // Calculate whether thief or person images will appear in this round
            FillImageList();

            // Set the round variables in the game storage
            round = new CatchTheThiefRound();
            round.UnidentifiedKeysPressed = new List <TimeAndKey>();
            round.ThiefAppearInRound      = thiefAppearInRound;
            round.PersonAppearInRound     = personAppearInRound;

            // Randomize the list of images that will appear in this round
            imageOrder = RamGenerator.PickNRandomElems(imageOrder, numberOfSquaresInGrid);
            // If the thief has been randomized to appear on the same square as in the last round
            while (imageOrder[indexThiefAppearedLastRound] == Images.THIEF)
            {
                // Randomize the list of images again
                imageOrder = RamGenerator.PickNRandomElems(imageOrder, numberOfSquaresInGrid);
            }

            yield return(null);
        }