Ejemplo n.º 1
0
    /// <summary>
    /// gère les inputs du jeu
    /// </summary>
    private void InputGame()
    {
        //if we win, just accept the changement scene
        if (winned)
        {
            if (idLevel == idLevelMax && readyToRestart)    //if this is the end and we can restart
            {
                if (PlayerConnected.getSingularity().getPlayer(0).GetButtonDown("FireB"))
                {
                    SceneChangeManager.getSingleton().JumpToSceneWithFade("Level 1");
                }
            }
            return;
        }
        if (loosed)
        {
            //if we loose, 1 inputs
            if (PlayerConnected.getSingularity().getPlayer(0).GetButtonDown("FireA"))
            {
                if (gameover_retryText.color.a != 1)
                {
                    gameover_canvas.GetComponent <Animator>().enabled = false;
                    gameover_trappedText.color = new Color(gameover_trappedText.color.r, gameover_trappedText.color.g, gameover_trappedText.color.b, 1);
                    gameover_retryText.color   = new Color(gameover_trappedText.color.r, gameover_trappedText.color.g, gameover_trappedText.color.b, 1);
                }
                else
                {
                    SceneChangeManager.getSingleton().JumpToSceneWithFade(SceneManager.GetActiveScene().name);
                }
            }
        }
        else
        {
            if (Time.unscaledTime < timeTmpForPauseEscape + 0.3f /* || transitionState*/)
            {
                return;
            }

            if (!paused && (PlayerConnected.getSingularity().getPlayer(0).GetButtonDown("Start") || PlayerConnected.getSingularity().getPlayer(0).GetButtonDown(0) || PlayerConnected.getSingularity().getPlayer(0).GetButtonDown(4) ||
                            PlayerConnected.getSingularity().getPlayer(0).GetButtonDown("Escape") || PlayerConnected.getSingularity().getPlayer(0).GetButtonDown(4)))
            {
                Paused();
            }
            else if (paused)
            {
                if (PlayerConnected.getSingularity().getPlayer(0).GetButtonDown("FireA") ||
                    PlayerConnected.getSingularity().getPlayer(0).GetButtonDown("Start"))
                {
                    Resume();
                }
                if (PlayerConnected.getSingularity().getPlayer(0).GetButtonDown("FireB") ||
                    PlayerConnected.getSingularity().getPlayer(0).GetButtonDown("Escape"))
                {
                    Time.timeScale = 1;
                    SceneChangeManager.getSingleton().JumpToSceneWithFade("Level 1");
                }
            }
        }
    }
Ejemplo n.º 2
0
 private void jumpNextLevel()
 {
     GlobalData.GetSingleton.TmpPlayerMovement = playerController.playerBody;
     SceneChangeManager.getSingleton().JumpToSceneWithFade("Level " + (idLevel + 2));
 }