Esempio n. 1
0
 /// <summary>
 /// Translate all texts when changing language or going to menu
 /// </summary>
 void TranslateTexts()
 {
     m_pressStartText.text = PMR_TextManager.GetText(PMR_TextSetup.Menu.PRESS_START);
     m_newGameText.text    = PMR_TextManager.GetText(PMR_TextSetup.Menu.NEW_GAME);
     m_bestScoreText.text  = PMR_TextManager.GetText(PMR_TextSetup.Menu.BEST_SCORE) + PlayerPrefs.GetInt(PMR_GameSetup.PlayerPrefs.BEST_SCORE, 0);
     m_difficultyText.text = PMR_TextManager.GetText(PMR_TextSetup.Menu.DIFFICULTY) + PMR_TextManager.GetText(PMR_GameManager.Instance.Difficulty.ToString());
     //m_optionsText.text = PMR_TextManager.GetText(PMR_TextSetup.Menu.OPTIONS);
     //m_creditsText.text = PMR_TextManager.GetText(PMR_TextSetup.Menu.CREDITS);
     m_exitText.text = PMR_TextManager.GetText(PMR_TextSetup.Menu.EXIT);
 }
        public void EndGame()
        {
            PMR_AudioManager.Instance.FadeOutBGM(2f);

            m_ended = true;
            int bestScore = PlayerPrefs.GetInt(PMR_GameSetup.PlayerPrefs.BEST_SCORE, 0);

            if (m_score > bestScore)
            {
                PlayerPrefs.SetInt(PMR_GameSetup.PlayerPrefs.BEST_SCORE, m_score);
            }

            m_endText.text        = PMR_TextManager.GetText(PMR_TextSetup.Game.END_TEXT);
            m_scoreEndText.text   = PMR_TextManager.GetText(PMR_TextSetup.Game.SCORE_TEXT) + m_score;
            m_restartbtnText.text = PMR_TextManager.GetText(PMR_TextSetup.Game.RESTART);
            m_backbtnText.text    = PMR_TextManager.GetText(PMR_TextSetup.Menu.BACK_TO_MENU);

            PMR_EventManager.TriggerEvent(PMR_EventSetup.Game.END_GAME);
        }
Esempio n. 3
0
        /// <summary>
        /// Just event system and change difficulty stuff
        /// </summary>
        private void Update()
        {
            if (m_state == MENU_STATE.PRESS_START)
            {
                if (PMR_InputManager.PressedSkipButton())
                {
                    m_state = MENU_STATE.MAIN;
                    m_eventSystem.SetSelectedGameObject(m_newGameText.transform.parent.gameObject);
                    ShowMainAnimation();
                }
            }
            else if (m_state == MENU_STATE.MAIN)
            {
                if (m_eventSystem.currentSelectedGameObject == null && (Input.GetKeyDown(KeyCode.DownArrow) || Input.GetKeyDown(KeyCode.UpArrow)))
                {
                    m_eventSystem.SetSelectedGameObject(m_newGameText.transform.parent.gameObject);
                }

                if (Input.GetKeyDown(KeyCode.Keypad1) && PMR_GameManager.Instance.Difficulty != DIFICULTY.EASY)
                {
                    PMR_GameManager.Instance.ChangeDifficulty(DIFICULTY.EASY);
                    m_difficultyText.text = PMR_TextManager.GetText(PMR_TextSetup.Menu.DIFFICULTY) + PMR_TextManager.GetText(PMR_GameManager.Instance.Difficulty.ToString());
                }


                if (Input.GetKeyDown(KeyCode.Keypad2) && PMR_GameManager.Instance.Difficulty != DIFICULTY.MID)
                {
                    PMR_GameManager.Instance.ChangeDifficulty(DIFICULTY.MID);
                    m_difficultyText.text = PMR_TextManager.GetText(PMR_TextSetup.Menu.DIFFICULTY) + PMR_TextManager.GetText(PMR_GameManager.Instance.Difficulty.ToString());
                }


                if (Input.GetKeyDown(KeyCode.Keypad3) && PMR_GameManager.Instance.Difficulty != DIFICULTY.DIFFICULT)
                {
                    PMR_GameManager.Instance.ChangeDifficulty(DIFICULTY.DIFFICULT);
                    m_difficultyText.text = PMR_TextManager.GetText(PMR_TextSetup.Menu.DIFFICULTY) + PMR_TextManager.GetText(PMR_GameManager.Instance.Difficulty.ToString());
                }
            }
        }
Esempio n. 4
0
        /// <summary>
        /// Coroutine called for loading the next scene
        /// </summary>
        /// <param name="_index"></param>
        /// <param name="_delayAfterLoading"></param>
        /// <param name="_eventName"></param>
        /// <returns></returns>
        IEnumerator LoadingScreen(int _index, float _delayAfterLoading = 1f, string _eventName = "")
        {
            m_loadingScreenGroup.SetActive(true);
            m_loadingText.text = PMR_TextManager.GetText(PMR_TextSetup.LoadingScreen.LOADING_TEXT);

            AsyncOperation asyncLoad = SceneManager.LoadSceneAsync(_index);

            // Wait until the asynchronous scene fully loads
            while (!asyncLoad.isDone)
            {
                yield return(null);
            }

            yield return(new WaitForSeconds(_delayAfterLoading));

            m_loadingScreenGroup.SetActive(false);

            if (_eventName != "")
            {
                PMR_EventManager.TriggerEvent(_eventName);
            }
        }