public IEnumerator WHEN_SquareRoundAdded1Round_THEN_SquareRoundGetterReturnsCorrectValues() { squaresData = new SquaresStorage(); squaresData.Rounds = new List <SquaresRound>(); round = new SquaresRound(); round.SquareHighlightDuration = 5.9f; // float value float expectedHighlightDuration = 5.9f; round.SquareHighlightInterval = 7.3f; // float value float expectedHighlightInterval = 7.3f; round.RecallTime = 8.59f; // float value float expectedRecallTime = 8.59f; IndexAndPosition testIndexAndPosition = new IndexAndPosition(3, new Position2D(3, 5)); round.HighlightedSquares = new List <IndexAndPosition>(); round.HighlightedSquares.Add(testIndexAndPosition); round.RecalledSquares = new List <IndexAndPosition>(); round.RecalledSquares.Add(testIndexAndPosition); squaresData.Rounds.Add(round); SquaresRound actualSquaresRound = squaresData.Rounds[0]; yield return(null); Assert.IsTrue(expectedHighlightDuration == actualSquaresRound.SquareHighlightDuration, ""); Assert.IsTrue(expectedHighlightInterval == actualSquaresRound.SquareHighlightInterval, ""); Assert.IsTrue(expectedRecallTime == actualSquaresRound.RecallTime, ""); Assert.IsTrue(testIndexAndPosition == round.RecalledSquares[0], ""); Assert.IsTrue(testIndexAndPosition == round.HighlightedSquares[0], ""); }
public IEnumerator WHEN_SquaresHighlightedSquaresCreated_THEN_SquaresHighlightedSquaresIsEmpty() { round = new SquaresRound(); round.HighlightedSquares = new List <IndexAndPosition>(); int expectedSizeOfList = 0; yield return(null); Assert.IsTrue(expectedSizeOfList == round.HighlightedSquares.Count, "HighlightedSquares list is not empty at creation."); }
public IEnumerator WHEN_SquaresRoundRecallTimeSet_THEN_SquaresRoundGetsCorrectValue() { round = new SquaresRound(); round.RecallTime = 7.59f; // float value float expectedRecallTime = 7.59f; yield return(null); Assert.IsTrue(expectedRecallTime == round.RecallTime, "Recall time getter returning incorrect value."); }
public IEnumerator WHEN_SquaresRoundSquareHighlightIntervalSet_THEN_SquaresRoundGetsCorrectValue() { round = new SquaresRound(); round.SquareHighlightInterval = 7f; // float value float expectedHighlightInterval = 7f; yield return(null); Assert.IsTrue(expectedHighlightInterval == round.SquareHighlightInterval, "SquareHighlightInterval getter returning incorrect value."); }
public IEnumerator WHEN_SquaresRoundSquareHighlightDurationSet_THEN_SquaresRoundGetsCorrectValue() { round = new SquaresRound(); round.SquareHighlightDuration = 4.9f; // float value float expectedHighlightDuration = 4.9f; yield return(null); Assert.IsTrue(expectedHighlightDuration == round.SquareHighlightDuration, "SquareHighlightDuration getter returning incorrect value: " + expectedHighlightDuration + " , " + round.SquareHighlightDuration); }
public IEnumerator WHEN_SquaresRecalledSquaresAdd1Item_THEN_SquaresRecalledSquaresHas1Item() { round = new SquaresRound(); round.RecalledSquares = new List <IndexAndPosition>(); round.RecalledSquares.Add(new IndexAndPosition(1, new Position2D(2, 3))); int expectedSizeOfList = 1; yield return(null); Assert.IsTrue(expectedSizeOfList == round.RecalledSquares.Count, "When one item is added to RecalledSquares, the size of RecalledSquares is incorrect"); }
public IEnumerator WHEN_SquaresHighlightedSquaresAdd1Item_THEN_SquaresHighlightedSquaresHas1Item() { IndexAndPosition testIndexAndPosition = new IndexAndPosition(3, new Position2D(3, 5)); round = new SquaresRound(); round.HighlightedSquares = new List <IndexAndPosition>(); round.HighlightedSquares.Add(testIndexAndPosition); int expectedSizeOfList = 1; yield return(null); Assert.IsTrue(expectedSizeOfList == round.HighlightedSquares.Count, "When one item is added to HighlightedSquares, the size of HighlightedSquares is incorrect"); }
public IEnumerator WHEN_SquareRoundAdded1Round_THEN_SquareRoundSizeIs1() { squaresData = new SquaresStorage(); squaresData.Rounds = new List <SquaresRound>(); round = new SquaresRound(); squaresData.Rounds.Add(round); int expectedSizeOfList = 1; yield return(null); Assert.IsTrue(expectedSizeOfList == squaresData.Rounds.Count, "round list does not have the added round."); }
public IEnumerator WHEN_SquaresRecalledSquaresSet_THEN_SquaresRoundGetsCorrectValue() { IndexAndPosition testIndexAndPosition = new IndexAndPosition(3, new Position2D(3, 5)); round = new SquaresRound(); round.RecalledSquares = new List <IndexAndPosition>(); round.RecalledSquares.Add(testIndexAndPosition); List <IndexAndPosition> expectedRecalledSquaresList = new List <IndexAndPosition>() { testIndexAndPosition }; yield return(null); Assert.IsTrue(expectedRecalledSquaresList[0] == round.RecalledSquares[0], "SquareHighlightInterval getter returning incorrect value"); }
/// <summary> /// Function for displaying the highlight sequence /// </summary> private IEnumerator HighlightSequenceStage() { roundNumber += 1; // Initialize round gameplay data variables round = new SquaresRound(); round.HighlightedSquares = new List <IndexAndPosition>(); round.RecalledSquares = new List <IndexAndPosition>(); round.SquareHighlightInterval = squareHighlightInterval; // float value round.SquareHighlightDuration = squareHighlightDuration; // float value // Randomly select a new square highlight sequence for the new round, // by using the existing list of square game objects squaresToHighlight = RamGenerator.PickNRandomElems(displayedSquares, numberOfHighlightedSquares); // Display the square highlight sequence yield return(StartCoroutine(HighlightSquareSequence(squaresToHighlight, squareHighlightInterval))); // Clear the list of squares recalled by the player recalledSquares = new List <IndexAndPosition>(); }