コード例 #1
0
    IEnumerator BackButtonRoutine()
    {
        isTransitioning = true;
        AsyncOperation async = SceneManager.LoadSceneAsync("Title", LoadSceneMode.Single);

        async.allowSceneActivation = false;
        fader.FadeOn();
        yield return(new WaitForSeconds(1f));

        async.allowSceneActivation = true;
        isTransitioning            = false;
        MainMenu.Open();
    }
コード例 #2
0
    IEnumerator EndGameRoutine()
    {
        m_isReadyToReload = false;

        if (screenFader != null)
        {
            screenFader.FadeOn();
        }

        if (m_isWinner)
        {
            messageWindow.GetComponent <RectXformMover>().MoveOn();
            messageWindow.ShowMessage(winIcon, "You WIN!", "OK");
        }
        else
        {
            messageWindow.GetComponent <RectXformMover>().MoveOn();
            messageWindow.ShowMessage(winIcon, "You LOSE!", "OK");
        }

        while (!m_isReadyToReload)
        {
            yield return(null);
        }

        SceneManager.LoadScene(SceneManager.GetActiveScene().name);
    }
コード例 #3
0
ファイル: GameManager.cs プロジェクト: pwillems/Flebibazio
    IEnumerator EndGameRoutine()
    {
        m_isReadyToReload = false;

        if (screenFader != null)
        {
            screenFader.FadeOn();
        }
        if (m_isWinner)
        {
            if (messageWindow != null)
            {
                messageWindow.GetComponent <RectXformMover>().MoveOn();
                messageWindow.ShowMessage(null, "YOU WIN", "YES");
            }
        }
        else
        {
            if (messageWindow != null)
            {
                messageWindow.GetComponent <RectXformMover>().MoveOn();
                messageWindow.ShowMessage(null, "YOU LOST :(", "SHIT");
            }
        }
        while (!m_isReadyToReload)
        {
            yield return(null);
        }

        SceneManager.LoadScene(SceneManager.GetActiveScene().name);
    }
コード例 #4
0
 void Start()
 {
     restartButton.Move();
     tryAgainText.FadeOn();
     thanksText.FadeOn();
     restartButtonFader.FadeOn();
 }
コード例 #5
0
    private IEnumerator EndGameRoutine()
    {
        isReadyToReload = false;

        if (isWinner)
        {
            if (messageWindow != null)
            {
                messageWindow.GetComponent <RectTransformMover>().MoveOn();
                messageWindow.ShowMessage(winIcon, "You Win!", "Play Again!");
            }
        }
        else
        {
            if (messageWindow != null)
            {
                messageWindow.GetComponent <RectTransformMover>().MoveOn();
                messageWindow.ShowMessage(loseIcon, "You Lose!", "Play Again!");
            }
        }

        yield return(new WaitForSeconds(1f));

        if (screenFader != null)
        {
            screenFader.FadeOn();
        }

        while (!isReadyToReload)
        {
            yield return(null);
        }

        SceneManager.LoadScene(SceneManager.GetActiveScene().name, LoadSceneMode.Single);
    }
コード例 #6
0
    IEnumerator EndGameRoutine()
    {
        m_isReadyToReload = false;
        while (!m_board.PlayerInputEnabled)
        {
            yield return(null);
        }

        yield return(new WaitForSeconds(1f));

        int currentScore = ScoreManager.Instance.CurrentScore;

        // WINNER
        if (m_isWinner)
        {
            if (messageWindow != null)
            {
                messageWindow.GetComponent <RectXformMover>().MoveOn();
                messageWindow.ShowMessage(winIcon, "YOU WON!\n" + currentScore.ToString(), scene.name, "Next Level");

                if (SoundManager.Instance != null)
                {
                    SoundManager.Instance.PlayRandomWinClip();
                }
            }
        }
        else
        {
            // LOOSER
            if (messageWindow != null)
            {
                messageWindow.GetComponent <RectXformMover>().MoveOn();
                messageWindow.ShowMessage(loseIcon, "YOU LOST!\n" + currentScore.ToString(), scene.name, "Try Again!");
                if (SoundManager.Instance != null)
                {
                    SoundManager.Instance.PlayRandomLooseClip();
                }
            }
        }

        //yield return new WaitForSeconds(2f);
        // fade overlay screne
        if (screenFader != null)
        {
            screenFader.FadeOn();
        }
        while (!m_isReadyToReload)
        {
            yield return(null);
        }

        SceneManager.LoadScene(scene.name);
    }
コード例 #7
0
    // coroutine for the end of the level
    IEnumerator EndGameRoutine()
    {
        // set ready to reload to false to give the player time to read the screen
        m_isReadyToReload = false;


        // if player beat the level goals, show the win screen and play the win sound
        if (m_isWinner)
        {
            if (messageWindow != null)
            {
                messageWindow.GetComponent <RectXformMover>().MoveOn();
                messageWindow.ShowMessage(winIcon, "YOU WIN!", "OK");
            }

            if (SoundManager.Instance != null)
            {
                SoundManager.Instance.PlayWinSound();
            }
        }
        // otherwise, show the lose screen and play the lose sound
        else
        {
            if (messageWindow != null)
            {
                messageWindow.GetComponent <RectXformMover>().MoveOn();
                messageWindow.ShowMessage(loseIcon, "YOU LOSE!", "OK");
            }

            if (SoundManager.Instance != null)
            {
                SoundManager.Instance.PlayLoseSound();
            }
        }
        // wait one second
        yield return(new WaitForSeconds(1f));

        // fade the screen
        if (screenFader != null)
        {
            screenFader.FadeOn();
        }

        // wait until read to reload
        while (!m_isReadyToReload)
        {
            yield return(null);
        }

        // reload the scene (you would customize this to go back to the menu or go to the next level
        // but we just reload the same scene in this demo
        SceneManager.LoadScene(SceneManager.GetActiveScene().name);
    }
コード例 #8
0
    IEnumerator EndGameRoutine()
    {
        // set ready to reload to false to give the player time to read the screen
        m_isReadyToReload = false;

        if (m_Winner.Equals(1))
        {
            Debug.Log("PLAYER 1 WIN!");
            if (gameStatusText != null)
            {
                gameStatusText.text = "PLAYER 1 WIN!";
            }
        }
        else if (m_Winner.Equals(0))
        {
            Debug.Log("DRAW");
            if (gameStatusText != null)
            {
                gameStatusText.text = "DRAW";
            }
        }
        else
        {
            Debug.Log("PLAYER 2 WIN!");
            if (gameStatusText != null)
            {
                gameStatusText.text = "PLAYER 2 WIN!";
            }
        }

        // wait one second
        yield return(new WaitForSeconds(1f));

        // fade the screen
        if (screenFader != null)
        {
            screenFader.FadeOn();
        }

        // wait until read to reload
        while (!m_isReadyToReload)
        {
            yield return(null);
        }


        // reload the scene (you would customize this to go back to the menu or go to the next level
        // but we just reload the same scene in this demo
        SceneManager.LoadScene("Main");
    }
コード例 #9
0
    IEnumerator EndGameRoutine()
    {
        m_isReadyToReload = false;

        if (m_isWinner)
        {
            //Debug.Log("YOU WIN");
            if (messageWindow != null)
            {
                messageWindow.GetComponent <RectXFormMover>().MoveOn();
                messageWindow.ShowMessage(winIcon, "YOU WIN!", "OK");
            }

            //play win sound
            if (SoundManager.Instance != null)
            {
                SoundManager.Instance.PlayWinSound();
            }
        }
        else
        {
            //Debug.Log("YOU LOSE");
            if (messageWindow != null)
            {
                messageWindow.GetComponent <RectXFormMover>().MoveOn();
                messageWindow.ShowMessage(loseIcon, "YOU LOSE!", "OK");
            }

            //play lose sound
            if (SoundManager.Instance != null)
            {
                SoundManager.Instance.PlayLoseSound();
            }
        }

        yield return(new WaitForSeconds(2f));

        if (screenFader != null)
        {
            screenFader.FadeOn();
        }

        while (!m_isReadyToReload)
        {
            yield return(null);
        }
        //just reload for now
        SceneManager.LoadScene(SceneManager.GetActiveScene().name);
    }
コード例 #10
0
    private IEnumerator EndGameRoutine()
    {
        mIsReadyToReload = false;

        if (mIsWinner)
        {
            if (messageWindow != null)
            {
                messageWindow.GetComponent <RectXformMover>().MoveOn();
                messageWindow.ShowMessage(winIcon, "YOU WIN!", "OK");
            }

            if (SoundManager.Instance != null)
            {
                SoundManager.Instance.PlayWinSound();
            }
        }
        else
        {
            if (messageWindow != null)
            {
                messageWindow.GetComponent <RectXformMover>().MoveOn();
                messageWindow.ShowMessage(loseIcon, "YOU LOSE!", "OK");
            }

            if (SoundManager.Instance != null)
            {
                SoundManager.Instance.PlayLoseSound();
            }
        }

        yield return(new WaitForSeconds(1f));

        if (screenFader != null)
        {
            screenFader.FadeOn();
        }

        while (!mIsReadyToReload)
        {
            yield return(null);
        }

        SceneManager.LoadScene(SceneManager.GetActiveScene().name);
    }
コード例 #11
0
 // fade on the ScreenFader when we start
 private void Start()
 {
     _screenFader.FadeOn();
 }