Beispiel #1
0
    public void ProcessTouch(TurnCardUI card)
    {
        if (!isBusy)
        {
            int x = card.posX;
            int y = card.posY;

            if (x < currentBoardMaxWidth && x >= currentBoardMinWidth &&
                y < currentBoardMaxHeight && y >= currentBoardMinHeight)
            {
                Debug.Log("Flip(" + x + "," + y + ")");
                isBusy = true;

                card.FlipCard();

                PropagateTouch(x + 1, y, 1, waitTimeStep);
                PropagateTouch(x, y + 1, 3, waitTimeStep);
                PropagateTouch(x - 1, y, 5, waitTimeStep);
                PropagateTouch(x, y - 1, 7, waitTimeStep);

                StartCoroutine(ResizeBorders());

                StartCoroutine(WaitNext());

                ++scoreCount;

                UIUpdateCurrentResult();
                GameLog.AddMove(x, y);
            }
        }
    }
Beispiel #2
0
    void ProcessTouch(float touchX, float touchY)
    {
        Ray        ray = Camera.main.ScreenPointToRay(new Vector3(touchX, touchY, 0));
        RaycastHit hit;

        if (Physics.Raycast(ray, out hit) && hit.transform.gameObject.name.StartsWith("Card"))
        {
            TurnCard card = hit.collider.GetComponent <TurnCard>();

            int x = card.posX;
            int y = card.posY;

            if (x < currentBoardMaxWidth && x >= currentBoardMinWidth &&
                y < currentBoardMaxHeight && y >= currentBoardMinHeight)
            {
                Debug.Log("Flip(" + x + "," + y + ")");
                isBusy = true;

                card.FlipCard();

                PropagateTouch(x + 1, y, 1, waitTimeStep);
                PropagateTouch(x, y + 1, 3, waitTimeStep);
                PropagateTouch(x - 1, y, 5, waitTimeStep);
                PropagateTouch(x, y - 1, 7, waitTimeStep);

                StartCoroutine(ResizeBorders());

                StartCoroutine(WaitNext());

                ++scoreCount;

                UpdateGUI_MovesCount();

                GameLog.AddMove(x, y);
            }
        }
    }