コード例 #1
0
        public void LinesSearcher_Lines_Find_Index_Starts_After_Second_Line()
        {
            int[] line1 = new int[] { 1, 2, 3, 4, 5 };
            int[] line2 = new int[] { 1, 2, 3, 6, 7 };
            int[] line3 = new int[] { 6, 7, 8, 9, 10 };

            int[][] linesAll = new int[][]
            {
                line1,
                line2,
                line3,
                line1,
                line2,
                line3,
                new int[] { 1, 2, 3, 9, 19 }
            };

            LinesSearcher searcher   = new LinesSearcher(linesAll);
            PayLine       line1Found = searcher.Find(line1, 4);
            PayLine       line2Found = searcher.Find(line2, 5);
            PayLine       line3Found = searcher.Find(line3, 6);

            Assert.AreEqual(0, line1Found.Index, "Invalid index of first line");
            Assert.AreEqual(1, line2Found.Index, "Invalid index of second line");
            Assert.AreEqual(2, line3Found.Index, "Invalid index of third line");
        }
コード例 #2
0
    private int RemoveCompletedLinesAndAddScore()
    {
        var result = LinesSearcher.SearchBy(GameBoardManager.Instance.field);

        foreach (var point in result.Points)
        {
            var ball = GameBoardManager.Instance.field[point.X, point.Y];
            if (ball != null)
            {
                ball.Die();
            }
            GameBoardManager.Instance.field[point.X, point.Y] = null;
            AudioManager.Instance.PlaySound(deleteBallsSound);
        }
        Score += result.Score;
        return(result.Points.Count);
    }
コード例 #3
0
        public void LinesSearcher_Lines_Find_NotFound()
        {
            int[] line1 = new int[] { 1, 2, 3, 4, 5 };
            int[] line2 = new int[] { 1, 2, 3, 6, 7 };
            int[] line3 = new int[] { 6, 7, 8, 9, 10 };

            int[][] linesAll = new int[][]
            {
                line1,
                line2,
                line3
            };

            LinesSearcher searcher = new LinesSearcher(linesAll);

            searcher.Find(new int[] { 4, 4, 4, 4, 4 });
        }
コード例 #4
0
        public void LinesSearcher_Lines_Find()
        {
            int[] line1 = new int[] { 1, 2, 3, 4, 5 };
            int[] line2 = new int[] { 1, 2, 3, 6, 7 };
            int[] line3 = new int[] { 6, 7, 8, 9, 10 };

            int[][] linesAll = new int[][]
            {
                line1,
                line2,
                line3
            };

            LinesSearcher searcher   = new LinesSearcher(linesAll);
            PayLine       line1Found = searcher.Find(line1);
            PayLine       line2Found = searcher.Find(line2);
            PayLine       line3Found = searcher.Find(line3);

            CollectionAssert.AreEqual(line1, line1Found.Line, "Invalid search result for line1");
            CollectionAssert.AreEqual(line2, line2Found.Line, "Invalid search result for line2");
            CollectionAssert.AreEqual(line3, line3Found.Line, "Invalid search result for line3");
        }