예제 #1
0
    // Update is called once per frame
    void Update()
    {
        if (startObject == null && !hasStarted)
        {
            hasStarted = true; timerScript.SetTimer(dur);
        }

        if (Input.GetMouseButtonDown(0))
        {
            Instantiate(sfx); state++; if (state == 3)
            {
                TimerScript.hasWon = true; sceneScript.LoadMainMenu();
            }
        }
        if (!TimerScript.hasFailed)
        {
            if (state == 1)
            {
                SR.sprite = sprites[0];
            }
            else if (state >= 2)
            {
                SR.sprite = sprites[1];
            }
        }
        else
        {
            SR.sprite = sprites[2];
        }
    }
예제 #2
0
    // Update is called once per frame
    void Update()
    {
        if (startObject == null && !hasStarted)
        {
            hasStarted = true; timerScript.SetTimer(dur);
        }

        if (transform.childCount <= 0 && !triggered && !TimerScript.hasFailed && !TimerScript.hasWon)
        {
            sceneScript.LoadMainMenu();
            print("Obama");
            triggered          = true;
            TimerScript.hasWon = true;
        }
    }
예제 #3
0
 void NextState()
 {
     state++;
     if (state == 4 || state == 6 || state == 8)
     {
         Instantiate(sfx, transform.position, Quaternion.identity);
     }
     if (state < 4 || state > 8)
     {
         camScript.NextCamera();
     }
     if (state >= 9 && !hasEnd)
     {
         sceneScript.LoadMainMenu(); hasEnd = true;
     }
 }
예제 #4
0
    // Update is called once per frame
    void Update()
    {
        if (hasFailed || hasWon)
        {
            text.gameObject.SetActive(false);
        }
        if (hasWon && !wonOnce)
        {
            wonOnce = true; Instantiate(correctSound, transform.position, Quaternion.identity);
        }
        if (!hasFailed && !hasWon && hasStarted)
        {
            timer     = timer - Time.deltaTime;
            text.text = "" + (int)timer;

            if (timer <= 0 && !hasFailed && !hasWon)
            {
                sceneScript.LoadMainMenu();
                print("IsThisLoss");
                hasFailed = true;
                Instantiate(failSound, transform.position, Quaternion.identity);
            }
        }
    }
예제 #5
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown("t"))
        {
            NextState();
            camScript.NextCamera();
        }

        switch (state)
        {
        case 05:
            if (Input.GetMouseButtonDown(0))
            {
                NextState(); sceneScript.LoadMainMenu();
            }
            if (!TimerScript.hasFailed && !TimerScript.hasWon)
            {
                TimerScript.hasWon = true;
            }
            break;

        case 04:
            if (!anim.GetCurrentAnimatorStateInfo(0).IsName("Pickup"))
            {
                if (!reversed)
                {
                    //chopsticks.transform.Translate(velocities[1], 0, 0);
                    chopsticks.transform.position = Vector3.SmoothDamp(chopsticks.transform.position, positions[6].position, ref zeroVector, velocities[3]);
                    if (Vector3.Distance(chopsticks.transform.position, positions[6].position) < threshold)
                    {
                        reversed = true;
                    }
                }

                else
                {
                    // chopsticks.transform.Translate(velocities[0], 0, 0);
                    chopsticks.transform.position = Vector3.SmoothDamp(chopsticks.transform.position, positions[7].position, ref zeroVector, velocities[3]);
                    if (Vector3.Distance(chopsticks.transform.position, positions[7].position) < threshold)
                    {
                        reversed = false;
                    }
                }



                if (Input.GetMouseButtonDown(0))
                {
                    anim.SetTrigger("Button");
                }
            }
            break;

        case 03:
            if (!anim.GetCurrentAnimatorStateInfo(0).IsName("Pickup"))
            {
                if (!reversed)
                {
                    //chopsticks.transform.Translate(velocities[1], 0, 0);
                    chopsticks.transform.position = Vector3.SmoothDamp(chopsticks.transform.position, positions[4].position, ref zeroVector, velocities[2]);
                    if (Vector3.Distance(chopsticks.transform.position, positions[4].position) < threshold)
                    {
                        reversed = true;
                    }
                }

                else
                {
                    // chopsticks.transform.Translate(velocities[0], 0, 0);
                    chopsticks.transform.position = Vector3.SmoothDamp(chopsticks.transform.position, positions[5].position, ref zeroVector, velocities[2]);
                    if (Vector3.Distance(chopsticks.transform.position, positions[5].position) < threshold)
                    {
                        reversed = false;
                    }
                }



                if (Input.GetMouseButtonDown(0))
                {
                    anim.SetTrigger("Button");
                }
            }
            break;

        case 02:
            if (!anim.GetCurrentAnimatorStateInfo(0).IsName("Pickup"))
            {
                if (!reversed)
                {
                    //chopsticks.transform.Translate(velocities[1], 0, 0);
                    chopsticks.transform.position = Vector3.SmoothDamp(chopsticks.transform.position, positions[2].position, ref zeroVector, velocities[1]);
                    if (Vector3.Distance(chopsticks.transform.position, positions[2].position) < threshold)
                    {
                        reversed = true;
                    }
                }

                else
                {
                    // chopsticks.transform.Translate(velocities[0], 0, 0);
                    chopsticks.transform.position = Vector3.SmoothDamp(chopsticks.transform.position, positions[3].position, ref zeroVector, velocities[1]);
                    if (Vector3.Distance(chopsticks.transform.position, positions[3].position) < threshold)
                    {
                        reversed = false;
                    }
                }



                if (Input.GetMouseButtonDown(0))
                {
                    anim.SetTrigger("Button");
                }
            }
            break;

        case 01:
            if (!anim.GetCurrentAnimatorStateInfo(0).IsName("Pickup"))
            {
                if (!reversed)
                {
                    //chopsticks.transform.Translate(velocities[1], 0, 0);
                    chopsticks.transform.position = Vector3.SmoothDamp(chopsticks.transform.position, positions[0].position, ref zeroVector, velocities[0]);
                    if (Vector3.Distance(chopsticks.transform.position, positions[0].position) < threshold)
                    {
                        reversed = true;
                    }
                }

                else
                {
                    // chopsticks.transform.Translate(velocities[0], 0, 0);
                    chopsticks.transform.position = Vector3.SmoothDamp(chopsticks.transform.position, positions[1].position, ref zeroVector, velocities[0]);
                    if (Vector3.Distance(chopsticks.transform.position, positions[1].position) < threshold)
                    {
                        reversed = false;
                    }
                }



                if (Input.GetMouseButtonDown(0))
                {
                    anim.SetTrigger("Button");
                }
            }

            break;

        default:
            if (Input.GetMouseButtonDown(0))
            {
                NextState();
            }
            break;
        }
    }