Esempio n. 1
0
    void Update()
    {
        if (transform.position.z < 0.15f && !isComplete)
        {
            isComplete = true;
            goalRigidbody.isKinematic = true;
            goalRigidbody.velocity    = Vector3.zero;
            completionTimeString      = (Time.time - offsetTime).ToString("000.00");
            goodJobText.text          = "Press enter to go to next level!\nYou took: " + completionTimeString + " seconds";
        }

        if (isComplete)
        {
            pastIsComplete = true;
        }

        if (pastIsComplete)
        {
            if (Input.GetKeyDown(KeyCode.Return))
            {
                levelMenu.loadNextLevel();
            }

            goodJobTextTransform.localPosition = Vector3.SmoothDamp(goodJobTextTransform.localPosition, new Vector3(0f, 900f, 0f), ref velocity, smoothTime);
        }

        isRobotEnabled = robotEnable.RobotState;

        if (isRobotEnabled && !pastIsRobotEnabled)
        {
            offsetTime = Time.time;
        }

        pastIsRobotEnabled = isRobotEnabled;
    }
    private void Update()
    {
        if (isComplete)
        {
            pastIsComplete = true;
        }

        if (pastIsComplete)
        {
            if (Input.GetKeyDown(KeyCode.Return))
            {
                levelMenu.loadNextLevel();
            }

            goodJobTextTransform.localPosition = Vector3.SmoothDamp(goodJobTextTransform.localPosition, new Vector3(0f, 900f, 0f), ref velocity, smoothTime);
        }

        isRobotEnabled = robotEnable.RobotState;

        if (isRobotEnabled && !pastIsRobotEnabled)
        {
            offsetTime = Time.time;
        }

        pastIsRobotEnabled = isRobotEnabled;
    }