FadeDown() public method

public FadeDown ( float fadeTime ) : void
fadeTime float
return void
Exemplo n.º 1
0
    public void MenuButtonClicked()
    {
        sceneToGo = "Menu";

        // Pause button now works if escape is pressed since we are no longer in Main menu.
        inMainMenu = true;

        // 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)
        {
            playMusic.FadeDown(fadeColorAnimationClip.length);
            Invoke("PlayMenuMusic", 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("LoadDelayedToMenu", fadeColorAnimationClip.length * .5f);
            // Set the trigger of Animator animColorFade to start transition to the FadeToOpaque state.
            animColorFade.SetTrigger("fadeIn");
        }
        // If changeScenes is false, call StartGameInScene
        else
        {
            // Call the StartGameInScene function to start game without loading a new scene.
            StartGameInScene();
        }
    }
Exemplo n.º 2
0
    public void StartButtonClicked()
    {
        Cursor.visible = false;

        AkSoundEngine.PostEvent("ui_validate", gameObject);
        //If changeMusicOnStart is true, fade out volume of music group of AudioMixer by calling FadeDown function of PlayMusic
        //To change fade time, change length of animation "FadeToColor"
        if (menuSettingsData.musicLoopToChangeTo != null)
        {
            playMusic.FadeDown(menuSettingsData.menuFadeTime);
        }

        //If changeScenes is true, start fading and change scenes halfway through animation when screen is blocked by FadeImage
        if (menuSettingsData.nextSceneIndex != 0)
        {
            StartCameraFade();

            // Start fade in other game instance
            if (isServer)
            {
                RpcStartCameraFade();
                NetworkedSceneChange();
            }
        }

        //If changeScenes is false, call StartGameInScene
        else
        {
            //Call the StartGameInScene function to start game without loading a new scene.
            StartGameInScene();
        }
    }
Exemplo n.º 3
0
    public void WarehouseButtonClicked()
    {
        sceneToStart = 1;

        //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)
        {
            playMusic.FadeDown(fadeColorAnimationClip.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");
            pauseScript.start();
            SceneManager.LoadScene(1, LoadSceneMode.Additive);

//			Application.LoadLevelAdditiveAsync ("Warehouse sample scene");
        }

        //If changeScenes is false, call StartGameInScene
//		else
//		{
        //Call the StartGameInScene function to start game without loading a new scene.
//			StartGameInScene();
//		}
    }
Exemplo n.º 4
0
    public void StartButtonClicked()
    {
        if (!inMainMenu)
        {
            return;
        }
        inMainMenu = false;
        //If changeMusicOnStart is true, fade out volume of music group of AudioMixer by calling FadeDown function of PlayMusic
        //To change fade time, change length of animation "FadeToColor"
        if (menuSettingsData.musicLoopToChangeTo != null)
        {
            playMusic.FadeDown(menuSettingsData.menuFadeTime);
        }

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

            StartCoroutine(FadeCanvasGroupAlpha(0f, 1f, fadeOutImageCanvasGroup));
        }

        //If changeScenes is false, call StartGameInScene
        else
        {
            //Call the StartGameInScene function to start game without loading a new scene.
            StartGameInScene();
        }
    }
Exemplo n.º 5
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 (changeMusicOnStart)
        {
            playMusic.FadeDown(fadeColorAnimationClip.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();
        }
    }
Exemplo n.º 6
0
 private void Update()
 {
     //如果当前场景不是菜单,音乐关掉
     if (SceneManager.GetActiveScene().buildIndex != 0)
     {
         playMusic.FadeDown(menuSettingsData.menuFadeTime);
     }
 }
Exemplo n.º 7
0
    public void ExecuteStartGame()
    {
        // Column start = World.Columns[new World3(0,0,0).GetHashCode()];
        // SampleSet results = InterpolatedNoise.Results[start.region];

        //Game.Player.transform.position = new Vector3(start.region.min.x, results.spawnMap.height[0,0] + 1f, start.region.min.z);

        loader.spawning        = true;
        Config.CoroutineTiming = defaultCoroutineTiming;

        if (changeMusicOnStart)
        {
            playMusic.FadeDown(fadeColorAnimationClip.length);
            Invoke("PlayNewMusic", fadeAlphaAnimationClip.length);
        }
        if (changeScenes)
        {
            Invoke("LoadDelayed", fadeColorAnimationClip.length * .5f);
            animColorFade.SetTrigger("fade");
        }
        else
        {
            StartGameInScene();
        }
    }
Exemplo n.º 8
0
    public void StartButtonClicked()
    {
        //If changeMusicOnStart is true, fade out volume of music group of AudioMixer by calling FadeDown function of PlayMusic
        //To change fade time, change length of animation "FadeToColor"
        if (menuSettingsData.musicLoopToChangeTo != null)
        {
            playMusic.FadeDown(menuSettingsData.menuFadeTime);
        }
        Debug.Log("Foobar");
        SceneManager.LoadScene(firstLevelScene);
        //If changeScenes is true, start fading and change scenes halfway through animation when screen is blocked by FadeImage

        /*if (menuSettingsData.nextSceneIndex != 0)
         *      {
         *              //Use invoke to delay calling of LoadDelayed by half the length of fadeColorAnimationClip
         *              Invoke ("LoadDelayed", menuSettingsData.menuFadeTime);
         *
         *  StartCoroutine(FadeCanvasGroupAlpha(0f, 1f, fadeOutImageCanvasGroup));
         *  SceneManager.LoadScene(firstLevelScene);
         *
         *
         * }
         *
         *      //If changeScenes is false, call StartGameInScene
         *      else
         *      {
         *              //Call the StartGameInScene function to start game without loading a new scene.
         *              StartGameInScene();
         *      }*/
    }
Exemplo n.º 9
0
 private void FadeOutMusicOnStartIfAppropriate()
 {
     if (ChangeMusicOnStart)
     {
         _playMusic.FadeDown(FadeColorAnimationClip.length);
     }
 }
    void Update()
    {
        if (Application.loadedLevel > 1)
        {
            playMusic.FadeDown(fadeColorAnimationClip.length);

            Invoke("Deactive", 1);
        }
    }
    public void StartButtonClicked()
    {
        if (changeMusicOnStart)
        {
            playMusic.FadeDown(fadeColorAnimationClip.length);
        }

        if (changeScenes)
        {
            Invoke("LoadDelayed", fadeColorAnimationClip.length * .5f);

            animColorFade.SetTrigger("fade");
        }
    }
Exemplo n.º 12
0
    public void RestartButtonClicked()
    {
        if (!lockRestart)
        {
            lockRestart = true;
            showPanels.DisableGameOverButtons();
            if (changeMusicOnStart)
            {
                playMusic.FadeDown(fadeColorAnimationClip.length);
                Invoke("PlayNewMusic", fadeAlphaAnimationClip.length);
            }

            inMainMenu = false;

            //Set trigger for animator to start animation fading out Menu UI
            animGameOverAlpha.SetTrigger("fade");

            //Wait until game has started, then hide the main menu
            Invoke("HideGameOverDelayed", fadeAlphaAnimationClip.length);

            Debug.Log("Game started in same scene! Put your game starting stuff here.");
        }
    }
Exemplo n.º 13
0
    public void StartButtonClicked()
    {
        //If changeMusicOnStart is true, fade out volume of music group of AudioMixer by calling FadeDown function of PlayMusic
        //To change fade time, change length of animation "FadeToColor"
        if (menuSettingsData.musicLoopToChangeTo != null)
        {
            playMusic.FadeDown(menuSettingsData.menuFadeTime);
        }

        else
        {
            //Call the StartGameInScene function to start game without loading a new scene.
            StartGameInScene();
        }
    }
Exemplo n.º 14
0
    public IEnumerator FadeCanvasGroupAlpha(float startAlpha, float endAlpha, CanvasGroup canvasGroupToFadeAlpha, bool disableFadeImage)
    {
        float elapsedTime   = 0f;
        float totalDuration = menuSettingsData.menuFadeTime;

        while (elapsedTime < totalDuration)
        {
            elapsedTime += Time.deltaTime;
            float currentAlpha = Mathf.Lerp(startAlpha, endAlpha, elapsedTime / totalDuration);
            canvasGroupToFadeAlpha.alpha = currentAlpha;
            yield return(null);
        }

        HideDelayed();
        Debug.Log("Coroutine done. Game started in same scene! Put your game starting stuff here.");

        m_playMusicScript.FadeDown(totalDuration);

        fadeImage.gameObject.SetActive(disableFadeImage);
    }
Exemplo n.º 15
0
    public void GameOver()
    {
        if (!gameStarted)
        {
            return;
        }

        gameStarted = false;
        MusicController.FadeDown(0.2F);
        GameOverSound.Play(750);
        var player = FindObjectOfType <PlayerMovementController>();

        if (player != null)
        {
            player.Paused         = true;
            player.rigid.velocity = Vector2.zero;
        }
        CodeGenerationRunner.Instance.Disable();
        GameOverScreen.Instance.gameObject.SetActive(true);
        EventSystem.current.SetSelectedGameObject(GameOverScreen.Instance.input.gameObject);
    }
Exemplo n.º 16
0
    public void StartButtonClicked()
    {
        /*
         * var input = GameObject.Find("SeedField").GetComponent<InputField>();
         *
         * if (input != null)
         * {
         *  if (!string.IsNullOrEmpty(input.text))
         *  {
         *      Random.InitState(input.text.ToUpper().GetHashCode());
         *      input.text = "";
         *      SceneManager.LoadScene("Hub");
         *  }
         * }
         */

        SimpleCharacterControl.canMove = true;
        //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)
        {
            playMusic.FadeDown(fadeColorAnimationClip.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");
        }
        else //If changeScenes is false, call StartGameInScene
        {
            //Call the StartGameInScene function to start game without loading a new scene.
            StartGameInScene();
        }
    }
Exemplo n.º 17
0
    public void StartButtonClicked()
    {
        camerasss.transform.position = startingPosition;

        //If changeMusicOnStart is true, fade out volume of music group of AudioMixer by calling FadeDown function of PlayMusic
        //To change fade time, change length of animation "FadeToColor"
        if (menuSettingsData.musicLoopToChangeTo != null)
        {
            playMusic.FadeDown(menuSettingsData.menuFadeTime);
        }

        //If changeScenes is true, start fading and change scenes halfway through animation when screen is blocked by FadeImage
        if (sceneToStart != 0)
        {
            StartCoroutine(FadeCanvasGroupAlpha(0f, 1f, fadeOutImageCanvasGroup));
            StartCoroutine(LoadNextScene(sceneToStart));
            //Pause button now works if escape is pressed since we are no longer in Main menu.
            inMainMenu = false;

            //Hide the main menu UI element
            showPanels.HideMenu();
        }
    }
Exemplo n.º 18
0
    public void StartButtonClicked()
    {
        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)
        {
            Invoke("LoadDelayed", fadeColorAnimationClip.length * .5f);


            animColorFade.SetTrigger("fade");
        }


        else
        {
            StartGameInScene();
        }
    }
Exemplo n.º 19
0
    public void StartButtonClicked()
    {
        System.GC.Collect();
//		GameStateManager.Instance.NumBerOfGame = 0;
        showPanels.gameTitleText.SetActive(false);
        GameStateManager.Instance.IsStarted = true;                                                     //keep loading the starting scene
        GameStateManager.Instance.StartGame();
//		Debug.Log(GameStateManager.HighScore);
        GameStateManager.Instance.Restart();
        updateScore.ChangeLiveScore();

        textColor.ChooseTextColor();
        //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)
        {
            playMusic.FadeDown(fadeColorAnimationClip.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();
        }
    }
Exemplo n.º 20
0
 public void StartButtonClicked()
 {
     playMusic.FadeDown(fadeColorAnimationClip.length);
     Invoke("LoadDelayed", fadeColorAnimationClip.length * .5f);
     animColorFade.SetTrigger("fade");
 }
Exemplo n.º 21
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 (changeMusicOnStart)
        {
            playMusic.FadeDown(fadeColorAnimationClip.length);
        }

        PlayerPrefs.DeleteAll();

        GameObject inputFieldGo = GameObject.Find("InpCasa1");
        InputField inputFieldCo = inputFieldGo.GetComponent <InputField>();
        string     jugador1     = inputFieldCo.text.Trim();

        inputFieldGo = GameObject.Find("InpCasa2");
        inputFieldCo = inputFieldGo.GetComponent <InputField>();
        string jugador2 = inputFieldCo.text.Trim();

        inputFieldGo = GameObject.Find("InpCasa3");
        inputFieldCo = inputFieldGo.GetComponent <InputField>();
        string jugador3 = inputFieldCo.text.Trim();

        inputFieldGo = GameObject.Find("InpCasa4");
        inputFieldCo = inputFieldGo.GetComponent <InputField>();
        string jugador4 = inputFieldCo.text.Trim();
        int    cuenta   = 0;

        if (jugador1.Length > 0)
        {
            PlayerPrefs.SetString("Jugador1", jugador1);
            cuenta++;
        }
        if (jugador2.Length > 0)
        {
            PlayerPrefs.SetString("Jugador2", jugador2);
            cuenta++;
        }
        if (jugador3.Length > 0)
        {
            PlayerPrefs.SetString("Jugador3", jugador3);
            cuenta++;
        }
        if (jugador4.Length > 0)
        {
            PlayerPrefs.SetString("Jugador4", jugador4);
            cuenta++;
        }

        Text txtMsg = GameObject.Find("TxtMsg").GetComponent <Text>();

        txtMsg.text = "";

        if (cuenta > 1)
        {
            if ((jugador1.ToString().Equals(jugador2.ToString()) && (jugador1.Length > 0 && jugador2.Length > 0)) ||
                (jugador1.ToString().Equals(jugador3.ToString()) && (jugador1.Length > 0 && jugador3.Length > 0)) ||
                (jugador1.ToString().Equals(jugador4.ToString()) && (jugador1.Length > 0 && jugador4.Length > 0)) ||
                (jugador2.ToString().Equals(jugador3.ToString()) && (jugador2.Length > 0 && jugador3.Length > 0)) ||
                (jugador2.ToString().Equals(jugador4.ToString()) && (jugador2.Length > 0 && jugador4.Length > 0)) ||
                (jugador3.ToString().Equals(jugador4.ToString()) && (jugador3.Length > 0 && jugador4.Length > 0)))
            {
                txtMsg.text = "Los nombres de los jugadores no pueden ser iguales";
                //Debug.Log ("nombres iguales");
            }
            else
            {
                PlayerPrefs.Save();

                GameObject modoJuego      = GameObject.FindGameObjectWithTag("ModoJuego");
                Text       dropModoJuego  = modoJuego.GetComponent <Text> ();
                string     textoModoJuego = dropModoJuego.text;
                //Debug.Log ("Imprimimos el modo del juego:"+ textoModoJuego);

                partida = new Partida(textoModoJuego, cuenta);
                //Debug.Log (partida.imprimeDatos ());



                PlayerPrefs.SetInt("Cuenta", cuenta);

                //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");

                //Call the StartGameInScene function to start game without loading a new scene.
                Application.LoadLevel("game");
            }
        }
        else
        {
            txtMsg.text = "Ingrese al menos dos jugadores";
        }
    }