Exemplo n.º 1
0
    // Update is called once per frame
    void Update()
    {
        if (hasStarted)
        {
            if (touchingSides < 2)
            {
                Vector3    mousePos  = Input.mousePosition;
                Ray        castPoint = orthoCam.ScreenPointToRay(mousePos);
                RaycastHit hit;
                if (Physics.Raycast(castPoint, out hit, Mathf.Infinity, ~8, QueryTriggerInteraction.Collide))
                {
                    snuggie.transform.position = hit.point;
                    //snuggieRB.velocity = ((transform.right * mousePos.x) + (transform.forward * mousePos.y)) / Time.deltaTime;
                    snuggieRB.velocity = (hit.point - snuggie.transform.position) * 10;
                }

                if (cup.transform.localPosition.y < minYPos)
                {
                    Debug.Log("Resetting cup");
                    FailedToCatch();
                }
            }
            else
            {
                if (hasWon == false)
                {
                    Debug.Log("WIN!");
                    pointCounter += winReward;
                    hasWon        = true;
                    miniMan.CloseMinigame(pointCounter);
                }
            }
            pointDisplay.text = pointCounter.ToString();
        }
    }
Exemplo n.º 2
0
    // A method called whenever a piece is placed to check for the puzzle being complete.
    public void CheckCompletion()
    {
        foreach (var piece in allPieces[difficultyThisRound])
        {
            // Check each piece in play this round...
            // If it's not in the right spot, return early.
            if (!piece.GetComponent <JigsawPiece>().correctPosition)
            {
                return;
            }
        }

        // If they are all in the right spot, you win!
        Debug.Log("Puzzle complete!");
        ResetBoard();
        myMiniManager.CloseMinigame(score);
        audioManager.PlaySound("Victory");
    }
Exemplo n.º 3
0
    // Update is called once per frame
    void Update()
    {
        if (hasStarted)
        {
            timeLeft -= Time.deltaTime;

            if (Input.GetAxisRaw("Horizontal") != 0)
            {
                balanceRB.AddTorque(balanceRB.transform.forward * sensitivity * -Input.GetAxis("Horizontal"));
            }
            if (cup.transform.localPosition.y <= minY)
            {
                FailedToCatch();
            }
            if (timeLeft <= 0)
            {
                miniMan.CloseMinigame(pointCounter);
            }
        }
    }