Ejemplo n.º 1
0
    private void GameOverBasicUpdate()
    {
        Sequencer sequencer = new Sequencer();

        Sequencer.Step step1 = (float progress) =>
        {
            gameOverRestartButton.interactable    = false;
            gameOverBackToMenuButton.interactable = false;
            backgroundSoundtrack.volume           = fixedSoundtrackVolume / 4;
        };
        Sequencer.Step step2 = (float progress) =>
        {
            gameOverBackground.color     = Utilities.SetAlpha(gameOverBackground.color, progress);
            gameOverTitle.color          = Utilities.SetAlpha(gameOverTitle.color, progress);
            gameOverBackToMenuText.color = Utilities.SetAlpha(gameOverBackToMenuText.color, progress);
            gameOverRestartText.color    = Utilities.SetAlpha(gameOverRestartText.color, progress);
        };
        Sequencer.Step flatSet = (float progress) =>
        {
            gameOverRestartButton.interactable    = true;
            gameOverBackToMenuButton.interactable = true;
            backgroundSoundtrack.volume           = fixedSoundtrackVolume;

            gameOverBackground.color     = Utilities.SetAlpha(gameOverBackground.color, 1f);
            gameOverTitle.color          = Utilities.SetAlpha(gameOverTitle.color, 1f);
            gameOverBackToMenuText.color = Utilities.SetAlpha(gameOverBackToMenuText.color, 1f);
            gameOverRestartText.color    = Utilities.SetAlpha(gameOverRestartText.color, 1f);
        };
        sequencer.SetSteps(step1, step2, flatSet);
        sequencer.SetStepsDuration(1f, 1f);
        sequencer.Invoke(Time.time - gameOverStartTime);
    }
Ejemplo n.º 2
0
    private void GameOverAdvancedUpdate()
    {
        Sequencer sequencer = new Sequencer();

        Sequencer.Step step1 = (float progress) =>
        {
            gameOverRestartButton.interactable    = false;
            gameOverBackToMenuButton.interactable = false;
            backgroundSoundtrack.volume           = fixedSoundtrackVolume / 4;
        };
        Sequencer.Step step2 = (float progress) =>
        {
            gameOverTitle.gameObject.SetActive(true);
            float curScale = MIN_TITLE_SCAlE + progress * TITLE_SCALE_DIST;
            gameOverTitle.transform.localScale = new Vector3(curScale, curScale, 1f);
            gameOverTitle.color      = Utilities.SetAlpha(gameOverTitle.color, progress);
            gameOverBackground.color = Utilities.SetAlpha(gameOverBackground.color, Mathf.Min(progress * BACKGROUND_FADING_SPEED, 1f));
        };
        Sequencer.Step step3 = (float progress) =>
        {
            gameOverTitle.color = Utilities.SetAlpha(gameOverTitle.color, 1f - progress);
        };
        Sequencer.Step step4 = (float progress) =>
        {
            gameOverBackToMenuText.color = Utilities.SetAlpha(gameOverBackToMenuText.color, progress);
            gameOverRestartText.color    = Utilities.SetAlpha(gameOverRestartText.color, progress);
        };
        Sequencer.Step flatSet = (float progress) =>
        {
            gameOverRestartButton.interactable    = true;
            gameOverBackToMenuButton.interactable = true;
            backgroundSoundtrack.volume           = fixedSoundtrackVolume;
            gameOverTitle.transform.localScale    = new Vector3(MAX_TITLE_SCAlE, MAX_TITLE_SCAlE, 1f);
            gameOverTitle.color          = Utilities.SetAlpha(gameOverTitle.color, 0f);
            gameOverBackground.color     = Utilities.SetAlpha(gameOverBackground.color, 1f);
            gameOverBackToMenuText.color = Utilities.SetAlpha(gameOverBackToMenuText.color, 1f);
            gameOverRestartText.color    = Utilities.SetAlpha(gameOverRestartText.color, 1f);
        };
        sequencer.SetSteps(step1, step2, step3, step4, flatSet);
        sequencer.SetStepsDuration(1f, 4.5f, 0.5f, 0.5f);
        sequencer.Invoke(Time.time - gameOverStartTime);
    }