public void GameOver()
    {
        if (!isGameOver)
        {
            if (MultiPlayerStat.isMultiMode())
            {
                isGameOver = true;
                //Player.playerInstance.die();
                CameraShake.instance.shakeCamera(.07f, .05f);
                AudioManager.instance.playSFX(0);
                gameTimeScale = 0.1f;
                //Time.timeScale = 0.1f;
                GameObject.Instantiate(losePrefab, Planet.planetinstance.transform);
                StartCoroutine(multiModeGameOverCorot());
                AudioManager.instance.playSFX(2);
            }
            else
            {
                ScoreManager.instance.saveScore(score);

                isGameOver = true;
                //Player.playerInstance.die();
                CameraShake.instance.shakeCamera(.07f, .05f);

                AudioManager.instance.playSFX(0);
                Time.timeScale = 0.1f;
                gameTimeScale  = 0.1f;
                GameObject.Instantiate(losePrefab, Planet.planetinstance.transform);

                StartCoroutine(gameOverCorot());
                AudioManager.instance.playSFX(2);
            }
        }
    }
    public void updateGamePlayTime()
    {
        if (MultiPlayerStat.isMultiMode())
        {
            return;
        }


        if (isGameOver && !MultiPlayerStat.isMultiMode())
        {
            return;
        }

        if (!InGameScene.instance.isGameStarted)
        {
            return;
        }

        if ((Time.unscaledDeltaTime - Time.deltaTime) > 1f)
        {
            playedTime += Time.deltaTime;
        }
        else
        {
            playedTime += Time.unscaledDeltaTime;
        }



        UIManager.instance.setTimeText(Mathf.RoundToInt(playedTime).ToString());
    }
Esempio n. 3
0
    private void offlineSnailUpdate()
    {
        if (MultiPlayerStat.isMultiMode())
        {
            return;
        }

        if (PlayerPrefs.GetInt("bestScore", 0) != 0)
        {
            playerSnail.localSlider.maxValue            = Mathf.Floor((bestScore * 1.5f) + (playerSnail.localSlider.value * 1.5f));
            playerSnail.localSlider.value               = Mathf.Lerp(playerSnail.localSlider.value, GameManager.instance.score, Time.deltaTime * 1f);
            PlayerRankSlider.instance.MaxScoreGoal.text = Mathf.Floor(playerSnail.localSlider.maxValue).ToString();
            PlayerRankSlider.instance.MidScoreGoal.text = Mathf.Floor((playerSnail.localSlider.maxValue / 2)).ToString();

            PlayerRankSlider.instance.lastRankSlider.maxValue = playerSnail.localSlider.maxValue;
            PlayerRankSlider.instance.lastRankSlider.value    = bestScore;
        }
        else
        {
            playerSnail.localSlider.maxValue            = (playerSnail.localSlider.value * 2f) + 1000;
            playerSnail.localSlider.value               = Mathf.Lerp(playerSnail.localSlider.value, GameManager.instance.score, Time.deltaTime * 1f);
            PlayerRankSlider.instance.MaxScoreGoal.text = Mathf.Floor(playerSnail.localSlider.maxValue).ToString();
            PlayerRankSlider.instance.MidScoreGoal.text = Mathf.Floor((playerSnail.localSlider.maxValue / 2)).ToString();

            PlayerRankSlider.instance.lastRankSlider.maxValue = playerSnail.localSlider.maxValue;
            PlayerRankSlider.instance.lastRankSlider.value    = 0;
        }
    }
Esempio n. 4
0
 void Start()
 {
     if (!MultiPlayerStat.isMultiMode())
     {
         setUpOfflineSnail();
         startPlaying();
     }
 }
 public void resumeGame()
 {
     if (!MultiPlayerStat.isMultiMode())
     {
         if (!isGameOver)
         {
             gamePaused     = false;
             Time.timeScale = 1f;
             gameTimeScale  = 1f;
             lockMouse();
             toggleJoystick(true);
         }
     }
 }
 public void pauseGame()
 {
     if (!MultiPlayerStat.isMultiMode())
     {
         if (!isGameOver)
         {
             gamePaused     = true;
             gameTimeScale  = 0f;
             Time.timeScale = 0f;
             unLockMouse();
             toggleJoystick(false);
         }
     }
 }
Esempio n. 7
0
 // Update is called once per frame
 void Update()
 {
     if (GameManager.instance.isGamePaused())
     {
         return;
     }
     requestGamePlayTimeUpdate();
     if (Input.GetKeyDown(KeyCode.Escape))
     {
         if (!MultiPlayerStat.isMultiMode())
         {
             AudioManager.instance.playSFX(3);
             UIManager.instance.pauseGame();
         }
     }
     offlineSnailUpdate();
     startGameIfLobbyFull();
 }