Example #1
0
        void HexagonSelectionHandler()
        {
            Vector3 touchedPosition;

            if (InputController._instance.GetScreenTouch(out touchedPosition))
            {
                selectedHexagonTrio = GetClosestHexagonTrio(new Vector2(touchedPosition.x, touchedPosition.y));
                trioCursorImage.transform.position = selectedHexagonTrio.center;
                if (lastTrio != null)
                {
                    lastTrio.SelectedHighlight();
                }
                lastTrio = selectedHexagonTrio;
                selectedHexagonTrio.SelectedHighlight();
            }
        }
Example #2
0
        IEnumerator TryToMatch(bool clockwise, HexagonTrio selectedHexagonTrio)
        {
            interactable = false;


            StartCoroutine(selectedHexagonTrio.TurnHexagonTrio(clockwise));    //First turn


            yield return(new WaitWhile(() => !selectedHexagonTrio.turnTrigger));


            if (GridController._instance.MatchingQuery())
            {
                CountMove();
                StopCoroutine(lastMatchCoroutine);
            }
            else
            {
                yield return(new WaitForSeconds(0.1f));

                StartCoroutine(selectedHexagonTrio.TurnHexagonTrio(clockwise));    //Second turn
            }

            yield return(new WaitWhile(() => !selectedHexagonTrio.turnTrigger));

            if (GridController._instance.MatchingQuery())
            {
                CountMove();

                StopCoroutine(lastMatchCoroutine);
            }
            else
            {
                yield return(new WaitForSeconds(0.1f));

                StartCoroutine(selectedHexagonTrio.TurnHexagonTrio(clockwise));    //Second turn
            }
            yield return(new WaitWhile(() => !selectedHexagonTrio.turnTrigger));


            interactable = true;
        }