コード例 #1
0
        public void Click(MatchingTile tile)
        {
            if (paused)
            {
                return;
            }

            if (tile == null)
            {
                return;
            }

            if (currentSelection == null)
            {
                currentSelection = tile;
            }
            else
            {
                currentSelection2 = tile;
                paused            = true;

                if (currentSelection.tile == currentSelection2.tile)
                {
                    StartCoroutine(SucessCoroutine());
                }
                else
                {
                    StartCoroutine(RetryCoroutine());
                }
            }

            tile.FlipUp();
        }
コード例 #2
0
        private IEnumerator SucessCoroutine()
        {
            yield return(new WaitForSeconds(resetDelay));

            if (currentSelection != null)
            {
                currentSelection.FlipUp();
            }

            if (currentSelection2 != null)
            {
                currentSelection2.FlipUp();
            }

            correctTiles.Add(currentSelection);
            correctTiles.Add(currentSelection2);

            if (correctTiles.Count >= matchingTiles.Count)
            {
                puzzleSuccessEvent.Invoke();
                StopGame();
            }

            currentSelection  = null;
            currentSelection2 = null;
            paused            = false;
        }