Пример #1
0
    public void StartButtonClicked()
    {
        //If changeMusicOnStart is true, fade out volume of music group of AudioMixer by calling FadeDown function of PlayMusic, using length of fadeColorAnimationClip as time.
        //To change fade time, change length of animation "FadeToColor"
        if (!lockStart)
        {
            showPanels.DisableMenuButtons();
            lockStart = true;
            if (changeMusicOnStart)
            {
                playMusic.FadeDown(fadeColorAnimationClip.length);
                Invoke("PlayNewMusic", fadeAlphaAnimationClip.length);
            }

            //If changeScenes is true, start fading and change scenes halfway through animation when screen is blocked by FadeImage
            if (changeScenes)
            {
                //Use invoke to delay calling of LoadDelayed by half the length of fadeColorAnimationClip
                Invoke("LoadDelayed", fadeColorAnimationClip.length * .5f);

                //Set the trigger of Animator animColorFade to start transition to the FadeToOpaque state.
                animColorFade.SetTrigger("fade");
            }

            //If changeScenes is false, call StartGameInScene
            else
            {
                //Call the StartGameInScene function to start game without loading a new scene.
                StartGameInScene();
            }
        }
    }