Пример #1
0
    public void StartGameInScene()
    {
        //Pause button now works if escape is pressed since we are no longer in Main menu.
        inMainMenu = false;

        //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 (changeMusicOnStart)
        {
            //Wait until game has started, then play new music
            Invoke("PlayNewMusic", fadeAlphaAnimationClip.length);
        }
        //Set trigger for animator to start animation fading out Menu UI


        //Wait until game has started, then hide the main menu



        if (gameManager.GameSaveFound)
        {
            showPanels.ShowLevelSelectPanel();
        }
        else
        {
            animMenuAlpha.SetTrigger("fade");
            Invoke("HideDelayed", fadeAlphaAnimationClip.length);

            if (!started)
            {
                StartCoroutine(gameManager.StartLevel("level1"));
                started = true;
            }
        }
        //Debug.Log ("Game started in same scene! Put your game starting stuff here.");
    }