Пример #1
0
        /// <summary>
        /// Opens shop when all particles have left scene.
        /// </summary>
        public void OnRoundOver()
        {
            pause.DisableButton();

            m_BGMAudioPlayer.SetPitch(1f, 1f);
            m_BGMAudioPlayer.SetVolume(0.2f, 1f);

            IsPlaying = false;
            m_PlayerShootController.PauseAll();

            m_AudioPlayer.PlayInstance(audioOnWaveComplete);
            m_RoundText.SetWaveCompleteText();
            m_RoundText.ShowForSeconds(2f, 1f, _WaitForParticles);
        }
Пример #2
0
        private void LostLife()
        {
            m_ShootController.PauseAll();

            m_CurrentLives--;

            m_AudioPlayer.PlayInstance(audioOnPlayerDeath);

            WarpGrid.WarpingGrid.Instance.ApplyExplosiveForce(4f, transform.position, 3f);

            SpawnExplosion(transform.position);

            if (OnDeath != null)
            {
                OnDeath();
            }

            foreach (var rend in spriteRenderers)
            {
                rend.enabled = false;
            }

            m_Collider.enabled = false;

            if (m_CurrentLives <= 0) // Game over
            {
                m_PlayerLivesUI.SetItemCount(0);
                m_GameManager.OnPlayerDeathGameOver();
            }
            else
            {
                m_AudioControls.SetVolume(0.2f, secondsToRespawn * 0.4f);
                m_AudioControls.SetVolume(1f, secondsToRespawn * 0.6f);

                m_AudioControls.SetPitch(0.98f, secondsToRespawn * 0.4f);
                m_AudioControls.SetPitch(1f, secondsToRespawn * 0.6f);

                m_PlayerLivesUI.SetItemCount(m_CurrentLives - 1);

                m_GameManager.OnPlayerDied();

                if (gameObject.activeSelf)
                {
                    StartCoroutine(ResetAfterSeconds(secondsToRespawn));
                }
            }
        }
Пример #3
0
        /// <summary>
        /// Button event. Pauses the game. Pauses round entities and updates UI.
        /// </summary>
        public void Pause()
        {
            GAME_MANAGER.PauseCurrentRoundEntities();

            BGM_AUDIO.SetVolume(0.3f, VOLUME_LERP_SECONDS);

            currentRoundText.text = (GAME_MANAGER.currentRoundIndex + 1).ToString();
            highestRoundText.text = HIGH_SCORE.highestRound.ToString();
            pointsText.text       = scoreHandler.score.ToString();

            pauseMenu.SetActive(true);

            foreach (var obj in objectsToHide)
            {
                obj.SetActive(false);
            }

            isPaused = true;
        }