Example #1
0
        public void Add_IsCumulative()
        {
            var scores = new ScoreCount(4);

            scores.Add(2, new[] { new Card(CardType.Blue, 1, 4) });
            scores.Add(2, new[] { new Card(CardType.Blue, 1, 3) });
            Assert.AreEqual(7, scores.Score(2));
            Assert.AreEqual(0, scores.Score(0));
            Assert.AreEqual(0, scores.Score(1));
            Assert.AreEqual(0, scores.Score(3));
        }
Example #2
0
        public void Add_AddsScoreForCorrectPlayer()
        {
            var scores = new ScoreCount(4);
            var cards  = new[]
            {
                new Card(CardType.Blue, 1, 4),
                new Card(CardType.Blue, 1, 3)
            };

            scores.Add(2, cards);
            Assert.AreEqual(7, scores.Score(2));
            Assert.AreEqual(0, scores.Score(0));
            Assert.AreEqual(0, scores.Score(1));
            Assert.AreEqual(0, scores.Score(3));
        }
Example #3
0
        public void Score_ReturnsInitialScoreOfZero()
        {
            var scores = new ScoreCount(4);

            for (int i = 0; i < 4; i++)
            {
                Assert.AreEqual(0, scores.Score(i));
            }
        }
Example #4
0
    //Score goal and reset the ball
    void ScoreGoal(Collider2D collision)
    {
        if (collision.gameObject.name == "Left Goal")
        {
            scoreCount = GameObject.Find("Right Score").GetComponent <ScoreCount>();
            scoreCount.Score();
            StartCoroutine(Initialize());
        }

        else if (collision.gameObject.name == "Right Goal")
        {
            scoreCount = GameObject.Find("Left Score").GetComponent <ScoreCount>();
            scoreCount.Score();
            StartCoroutine(Initialize());
        }
    }