예제 #1
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));
                }
            }
        }
예제 #2
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);
        }