示例#1
0
        /*
         * 재검토
         * - 패턴 데이터 검사
         * - 결과는 매치와 매칭의 종류(new)
         * - bug: 22 & match3
         */
        private void FindMatchingTiles(int row, int col, MatchInfo findinfo)
        {
            Tile baseTile = _gamepanel.tiles[row, col];

            if (baseTile.IsChecked)
            {
                return;
            }
            else
            {
                baseTile.IsChecked = true;
            }

            // 검사 기준을 먼저 둔다
            findinfo.SetCreationPos(row, col);

            FindMatch(row, col, findinfo, FindDirection.Horizon);
            FindMatch(row, col, findinfo, FindDirection.Vertical);
            if (findinfo.isMatch)
            {
                AddCreatetionMatchInfo(new MatchInfo(findinfo));
            }

            // 레퍼런스 게임 참조
            if (findinfo.isMatch == false || findinfo.matchType == MatchType.Normal)
            {
                IsMatch2by2(row, col);
            }

            findinfo.Reset();
        }
示例#2
0
        //
        private bool IsMatch2by2(int row, int col)
        {
            var curtile = _gamepanel.tiles[row, col];

            if (curtile == null)
            {
                return(false);
            }

            List <Tile> matchCandidates = new List <Tile>();
            var         pattern         = Square22Pattern.Instance;
            bool        isFound         = isMatchedPattern(pattern, curtile, matchCandidates);

            if (isFound)
            {
                findinfo.Reset();
                findinfo.SetCreationPos(row, col);

                findinfo.matchType = MatchType.Butterfly;
                findinfo.isMatch   = true;
                curtile.removeType = MatchType.Butterfly; //

                // makeMatch 내의 루프 참조
                foreach (var tile in matchCandidates)
                {
                    bool bAddPostion = !tile.IsMatched;
                    if (tile.IsMatched)
                    {
                        var matchedInfo = findMatchInfo(tile.row, tile.col);
                        if (matchedInfo == null)
                        {
                            continue;
                        }

                        Debug.LogFormat("교차점[{0},{1}] 발견", tile.row, tile.col);
                        // if (matchedInfo.matchType == MatchType.Normal)
                        // {
                        //     // 해당 좌표만 제거
                        //     matchedInfo.matchlist.Remove(tile.GetLocation());
                        //     bAddPostion = true;
                        // }
                    }

                    if (bAddPostion)
                    {
                        findinfo.AddTilePosition(tile.GetLocation());
                        tile.MarkFound();
                    }
                }

                AddCreatetionMatchInfo(new MatchInfo(findinfo));
            }
            matchCandidates.Clear();
            return(isFound);
        }