コード例 #1
0
        private void TryCheckSwipedCells(ICell cell)
        {
            _swipeCounter++;

            IList <ICell> cellsList = new List <ICell>(_checkManager.CheckCell(cell));

            if (cellsList.Count > 2 || cell.CurrentGameObject.CompareTag(StringsAndConst.TAG_POWER))
            {
                if (cell.CurrentGameObject.CompareTag(StringsAndConst.TAG_POWER))
                {
                    cellsList.Add(cell);
                }

                _matchedCellsDictionary.Add(cell, cellsList);

                _isMatchedSwipe = true;
            }

            if (_swipeCounter > 1)
            {
                if (_isMatchedSwipe)
                {
                    StartCoroutine(DestroyMatchedCells(_matchedCellsDictionary));
                }
                else
                {
                    _matchedCellsDictionary.Clear();

                    UndoMacroCommand();
                }

                _isMatchedSwipe = false;
                _swipeCounter   = 0;
            }
        }
コード例 #2
0
        public void TryCheckSwipedCells(ICell cell, int swipeCount = -1)
        {
            if (swipeCount > 0)
            {
                _swipeCounter = swipeCount;
            }
            else
            {
                _swipeCounter++;
            }

            AxisTypesEnum majorAxis;
            IList <ICell> cellsList = new List <ICell>(_checkManager.CheckCell(cell, out majorAxis));

            if (cellsList.Count > 2 || cell.CurrentGameObject.CompareTag(Strings.TAG_POWER))
            {
                if (cell.CurrentGameObject.CompareTag(Strings.TAG_POWER))
                {
                    cellsList.Add(cell);
                }

                _matchedCellsDictionary.Add(cellsList, majorAxis);
                _matchedCellsWithAxisDictionary.Add(cell, _matchedCellsDictionary);

                _isMatchedSwipe = true;
            }

            if (_swipeCounter > 1)
            {
                if (_isMatchedSwipe)
                {
                    StartCoroutine(MarkAndDestroy(_matchedCellsWithAxisDictionary));
                }
                else
                {
                    _matchedCellsWithAxisDictionary.Clear();
                    _matchedCellsDictionary.Clear();

                    UndoMacroCommand();
                }

                _isMatchedSwipe = false;
                _swipeCounter   = 0;
            }
        }