Exemplo n.º 1
0
    void Update()
    {
        if (Input.touchCount > 0)
        {
            Touch   touch         = Input.GetTouch(0);
            Vector2 touchPosition = Camera.main.ScreenToWorldPoint(touch.position);

            if (touch.phase == TouchPhase.Began)
            {
                Collider2D touchCollider = Physics2D.OverlapPoint(touchPosition);

                if (coll == touchCollider)
                {
                    if (canClick)
                    {
                        if (ordemCerta == ordemClicks)
                        {
                            ordemCerta++;
                            sprite.enabled = true;
                            sm.AudioRuna();
                        }
                        else
                        {
                            errado = true;
                        }
                    }
                }
                if (!coll == touchCollider)
                {
                }
            }

            if (touch.phase == TouchPhase.Moved)
            {
            }

            if (touch.phase == TouchPhase.Ended)
            {
            }
        }

        if (errado)
        {
            sprite.enabled = true;
            ordemCerta     = 1;
            canClick       = false;
            StartCoroutine(Wrong());
        }
        if (ordemCerta > 6)
        {
            print("Cabo");
            canClick              = false;
            coll.enabled          = false;
            Globals.armarioAberto = true;
            armario.SetActive(true);
        }
    }