Exemplo n.º 1
0
    // Update is called once per frame
    void Update()
    {
        if (cardA != null && !cardA.isSelected())
        {
            cardA.selectLearnCard();
        }
        if (cardB != null && !cardB.isSelected())
        {
            cardB.selectLearnCard();
        }

        if (cardA != null && cardB != null && cardA.isSelected() && cardB.isSelected() && !onOperation)
        {
            initOperation();
        }

        if ((Input.GetMouseButtonUp(0)) && !GameSettings.panelOpened)
        {
            RaycastHit2D hit = Physics2D.Raycast(Camera.main.ScreenToWorldPoint(Input.mousePosition), Vector2.zero, Mathf.Infinity, 1 << 5);

            if (hit.collider != null && (hit.collider.gameObject.Equals(bu_verify.gameObject)))
            {
                if (bu_verify.GetComponent <SpriteRenderer>().material.color.a == 1)
                {
                    verifyOperation();
                }
            }

            if (hit.collider != null && (hit.collider.gameObject.Equals(bu_end.gameObject)))
            {
                if (bu_verify.GetComponent <SpriteRenderer>().material.color.a == 0)
                {
                    gameManager.playAudioBu_press();
                    gameManager.openPause();
                }
            }
        }

        if (timeToNewTurn >= 0)
        {
            timeToNewTurn -= Time.deltaTime;
        }

        if (timeToNewTurn <= 0 && timeToNewTurn > -5 && cardA != null && cardB != null)
        {
            Destroy(cardA.gameObject);
            Destroy(cardB.gameObject);
            cardA = null;
            cardB = null;
            gameManager.initTurn();
            timeToNewTurn = -10;
        }
    }
 // Use this for initialization
 void Start()
 {
     currentSituation = 0;
     timeToWait       = 2;
     name.GetComponent <SpriteRenderer> ().color      = new Color(1, 1, 1, 0);
     fadePlane.GetComponent <SpriteRenderer> ().color = new Color(0, 0, 0, 0);
 }
    // Use this for initialization
    void Start()
    {
        //Remover depois
        //responsePanel.showPanel ("10 X 10 = 100");

        t           = transform;
        onOperation = false;
        onOperators = false;

        sum.setUseThis(true);
        sum.gameObject.transform.position = new Vector3(0, 0, 0);
        sum.gameObject.SetActive(false);

        sub.setUseThis(true);
        sub.gameObject.transform.position = new Vector3(0, 0, 0);
        sub.gameObject.SetActive(false);

        div.setUseThis(true);
        div.gameObject.transform.position = new Vector3(0, 0, 0);
        div.gameObject.SetActive(false);

        mul.setUseThis(true);
        mul.gameObject.transform.position = new Vector3(0, 0, 0);
        mul.gameObject.SetActive(false);

        operationChoosed = false;
        waitingForResult = false;

        bu_cancel.SetActive(true);
        bu_cancel.transform.position = new Vector3(0, -10, 0);

        bu_accept.SetActive(true);
        bu_accept.transform.position = new Vector3(0, -10, 0);

        equals.GetComponent <SpriteRenderer> ().material.color = new Color(1, 1, 1, 0);
    }