// Update is called once per frame
    void Update()
    {
        if (canPick == true)
        {
            if (GvrPointerInputModule.Pointer.TriggerDown || Input.GetKeyDown("space"))
            {
                RaycastHit hit;

                if (Physics.Raycast(transform.position, transform.forward, out hit))
                {
                    Cup cup = hit.transform.GetComponent <Cup> ();
                    if (cup != null)
                    {
                        canPick = false;

                        picked = true;
                        won    = (cup.ball != null);

                        cup.MoveUp();
                    }
                }
            }
        }
    }
Exemple #2
0
    // Update is called once per frame
    void Update()
    {
        if (canPick == true)
        {
            if (GvrPointerInputModule.Pointer.TriggerDown ||
                Input.GetMouseButtonDown(0) ||
                Input.GetKeyDown(KeyCode.Space))
            {
                RaycastHit hit;
                if (Physics.Raycast(transform.position, transform.forward, out hit))
                {
                    Cup cup = hit.transform.GetComponent <Cup> ();
                    if (cup != null)
                    {
                        canPick = false;
                        picked  = true;
                        won     = (cup.ball != null);                     // cup is holding the ball

                        cup.MoveUp();
                    }
                }
            }
        }
    }