Beispiel #1
0
    private void OnMenuButtonClick()
    {
        GameDetailsUI.SetActive(false);
        scorePauseText.text = "SCORE: " + score.ToString();

        if (currentLevel == Levels.maxLevels)
        {
            highScorePauseText.text = "HIGH SCORE: " + highScore.ToString();
        }
        else
        {
            highScorePauseText.text = "MAX SCORE: " + highScore.ToString();
        }

        if (Bird.gameStatus == Bird.GameStatus.DEAD)
        {
            gameOverText.text   = "OOPS! BIRD DIED";
            tapToStartText.text = "FLAP TO RESTART";
        }
        else if (Bird.gameStatus == Bird.GameStatus.PAUSED)
        {
            gameOverText.text   = "GAME PAUSED";
            tapToStartText.text = "TAP TO CONTINUE";
        }
        else
        {
            gameOverText.color  = new Color32(0, 204, 0, 255);
            gameOverText.text   = "LEVEL COMPLETED";
            tapToStartText.text = "TAP TO CONTINUE";
        }

        PauseUI.SetActive(true);
        Time.timeScale = 0f;
    }
Beispiel #2
0
    // Use this for initialization
    void Start()
    {
        if (GameInstance.CurrentLevel != null && GameInstance.CurrentLevel.isCustom)
        {
            LoadCustomLevel();
        }

        Instance       = this;
        Time.timeScale = 1;
        winMenu.gameObject.SetActive(false);



        Spawnpoint = initialSpawnPoint;
        if (Spawnpoint == null)
        {
            Spawnpoint = GameObject.Find("InitSpawnPoint").GetComponent <CheckPoint>();
        }

        Spawnpoint.TurnOn();
        SpawnNewPlayer();
        centerText.text = "";
        paused          = false;
        PauseUI.SetActive(false);
        StartTime = Time.time;
    }
Beispiel #3
0
 void PauseGame()
 {
     pauseBG.SetActive(true);
     Cursor.visible   = true;
     Cursor.lockState = CursorLockMode.None;
     PauseUI.SetActive(true);
     gamePaused     = true;
     Time.timeScale = 0f;
 }
Beispiel #4
0
 public void WinGame()
 {
     paused         = true;
     Time.timeScale = 0;
     EndTime        = Time.time - StartTime;
     NormalUI.SetActive(false);
     PauseUI.SetActive(false);
     winMenu.gameObject.SetActive(true);
     winMenu.UpdateWin();
 }
Beispiel #5
0
 public void Resume()
 {
     SoundController.Sound.Click();
     if (GameController.gameController.GameState == (int)GameState.PAUSE)
     {
         GameController.gameController.GameState = (int)GameState.PLAYING;
         NoSelect.SetActive(false);
         PauseUI.SetActive(false);
         Time.timeScale = 1;
     }
 }
Beispiel #6
0
 public void Pause()
 {
     SoundController.Sound.Click();
     if (GameController.gameController.GameState == (int)GameState.PLAYING)
     {
         GameController.gameController.GameState = (int)GameState.PAUSE;
         NoSelect.SetActive(true);
         PauseUI.SetActive(true);
         Time.timeScale = 0;
     }
 }
Beispiel #7
0
 public void Pause()
 {
     foreach (Button btn in typeWordManager.keyboardBgColor.GetComponentsInChildren <Button>())
     {
         btn.interactable = false;
     }
     Time.timeScale = 0f;
     PauseUI.SetActive(true);
     typeWordManager.bonusWordCanvas.SetActive(false);
     wordsCanvas.SetActive(false);
     GameisPaused = true;
 }
Beispiel #8
0
    public void Resume()
    {
        if (PauseSettings.activeSelf)
        {
            PauseSettings.SetActive(false);
        }

        pauseBG.SetActive(false);
        Cursor.visible   = false;
        Cursor.lockState = CursorLockMode.Locked;
        PauseUI.SetActive(false);
        gamePaused     = false;
        Time.timeScale = 1f;
    }
Beispiel #9
0
    public void Pause(bool pause)
    {
        if (pause)
        {
            u = UIState.PAUSE;
            Time.timeScale = 0;
            PauseUI.SetActive(true);
            NormalUI.SetActive(false);
            winMenu.gameObject.SetActive(false);
        }
        else
        {
            u = UIState.GAME;
            Time.timeScale = 1;
            PauseUI.SetActive(false);
            NormalUI.SetActive(true);
            winMenu.gameObject.SetActive(false);
        }

        paused = pause;
    }
Beispiel #10
0
 // Update is called once per frame
 void Update()
 {
     if (Bird.gameStatus == Bird.GameStatus.DEAD || Bird.gameStatus == Bird.GameStatus.UPGRADING || Bird.gameStatus == Bird.GameStatus.PAUSED)
     {
         OnMenuButtonClick();
         if (Input.GetMouseButtonDown(0))
         {
             if (Input.mousePosition.y < dispalyHeight && Input.mousePosition.x < displayWidth)
             {
                 if (Bird.gameStatus != Bird.GameStatus.PAUSED)
                 {
                     SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex);
                 }
                 else
                 {
                     GameDetailsUI.SetActive(true);
                     PauseUI.SetActive(false);
                     Bird.gameStatus = Bird.GameStatus.PLAYING;
                 }
                 Time.timeScale = 1f;
             }
         }
     }
 }
Beispiel #11
0
 public void GoOn()
 {
     PauseUI.SetActive(false);
     Time.timeScale = 1;
 }
Beispiel #12
0
 public void Pause()
 {
     PauseUI.SetActive(true);
     Time.timeScale = 0;
 }