示例#1
0
    // Update is called once per frame
    void Update()
    {
        if (transform.position.y < maxY)
        {
            transform.Translate(new Vector3(0, moveUpSpeed * Time.deltaTime, 0));
        }
        else
        {
            transform.position = new Vector3(transform.position.x, maxY, transform.position.z);
        }


        timeToEndCredits          = MathfPlus.DecByDeltatimeToZero(timeToEndCredits);
        delayTimeToCheckEscapeKey = MathfPlus.DecByDeltatimeToZero(delayTimeToCheckEscapeKey);

        if (timeToEndCredits == 0)
        {
            GameController.LoadMainMenu();
        }

        if (!isEndingSceneByEscapeKey)
        {
            if (delayTimeToCheckEscapeKey == 0 && CustomInputManager.KeyDown_Escape()) //GameController.GetKeyDown(KeyCode.Escape))
            {
                isEndingSceneByEscapeKey = true;
            }
        }

        if (isEndingSceneByEscapeKey)
        {
            musicAudioInfo.SetCustomVolume(musicAudioInfo.customVolume - Time.deltaTime * audioFadeSpeed);

            if (musicAudioInfo.customVolume == 0)
            {
                GameController.LoadMainMenu();
            }
        }
    }