Exemple #1
0
    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    //	* New Method: Perform Rattle Shake Check
    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    private bool PerformRattleShakeCheck()
    {
        // Increment Current Consecutive Shakes Count
        m_iCurrentRattleShakes += 1;

        // If the user took too long to make another shake, reset the rattle count
        if (m_ttRattleTimer.TimeUp())
        {
            m_iCurrentRattleShakes = 1;
        }

        // Reset Rattle timer (it would be unfair if we didn't reset the timer and allow the user as much time as possible to make another shake occur)
        m_ttRattleTimer.Reset();

        // Got enough shakes? Awesome. Make the Rattle Sound
        if (m_iCurrentRattleShakes >= m_iRattleShakesNeeded)
        {
            if (!m_bSoundPlayed)
            {
                AudioSourceManager.PlayAudioClip(m_rTambSoundManager.GetTambourineSound(TambourineSoundsManager.SoundTypes.RATTLE_TAMBOURINE_SHAKE));
                ShowShakenTambourine();
            }
            m_bSoundPlayed = true;
            return(true);
        }
        return(false);
    }
Exemple #2
0
    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    //	* Derived Method: On Trigger
    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    protected override void OnTrigger()
    {
        base.OnTrigger();
        StartCymbalShake(m_fTotalShakeTime);


        // Challenge Mode Active? Make Sure Sound can be played before it will can be heard
        if (m_rChallengeGameManager != null && m_rChallengeGameManager.Active)
        {
            if (m_rChallengeGameManager.IsChallenge)
            {
                m_rChallengeGameManager.SuccessfulHit(m_eSoundType);
                if (m_rSoundManager != null)
                {
                    AudioSourceManager.PlayAudioClip(m_rSoundManager.GetTambourineSound(m_eSoundType));
                    if (m_rTambInstrumentManager != null)
                    {
                        m_rTambInstrumentManager.CurrentInstrumentHitCount += 1;
                    }
                }
            }
        }

        // Otherwise Play Normally.
        else if (m_rSoundManager != null)
        {
            AudioSourceManager.PlayAudioClip(m_rSoundManager.GetTambourineSound(m_eSoundType));
            if (m_rTambInstrumentManager != null)
            {
                m_rTambInstrumentManager.CurrentInstrumentHitCount += 1;
            }
        }
    }
Exemple #3
0
 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 //	* New Method: Play Button Sound
 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 public virtual void PlayButtonSound()
 {
     if (m_acClipToPlay != null)
     {
         AudioSourceManager.PlayAudioClip(m_acClipToPlay);
     }
 }
Exemple #4
0
 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 //	* New Method: Play Scene BGM
 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 public void PlaySceneBGM()
 {
     if (m_oSubsceneAudioHandler != null)
     {
         AudioSourceManager.PlayAudioClip(m_oSubsceneAudioHandler);
     }
 }
Exemple #5
0
 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 //	* New Callback Method: On "CONSECUTIVELY_STATIC" Play Triggered
 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 private void OnConsecutivelyStaticPlayTriggered()
 {
     if (sm_iUsedAudioID == -1 || !AudioSourceManager.IsPlayingAudio(sm_iUsedAudioID))
     {
         sm_iUsedAudioID = AudioSourceManager.PlayAudioClip(m_acClipToPlay);
         LowerSceneBGM();
     }
 }
Exemple #6
0
 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 //	* New Callback Method: On "CONSECUTIVELY" Play Triggered
 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 private void OnConsecutivelyPlayTriggered()
 {
     if (m_iProvidedAudioID == -1 || !AudioSourceManager.IsPlayingAudio(m_iProvidedAudioID, m_acClipToPlay))
     {
         m_iProvidedAudioID = AudioSourceManager.PlayAudioClip(m_acClipToPlay);
         LowerSceneBGM();
     }
 }
Exemple #7
0
 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 //	* New Callback Method: On "ONLY ONCE" Play Triggered
 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 private void OnOnlyOncePlayTriggered()
 {
     if (m_iProvidedAudioID == -1)
     {
         m_iProvidedAudioID = AudioSourceManager.PlayAudioClip(m_acClipToPlay);
         LowerSceneBGM();
     }
 }
Exemple #8
0
 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 //	* Overwritten Method: Play Button Sound
 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 public override void PlayButtonSound()
 {
     if (m_rLanguageManager != null && m_rLanguageManager.IsLanguageAvailable(m_eLanguageSelection))
     {
         AudioSourceManager.PlayAudioClip(m_acClipToPlay);
     }
     else
     {
         AudioSourceManager.PlayAudioClip(m_acLanguageUnavailableSoundEffect);
     }
 }
Exemple #9
0
    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    //	* New Method: Stop Metronome
    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    private IEnumerator PlayMetronome(float trackBPM)
    {
        float fWaitTime = (1.0f / trackBPM) * 60.0f;

        while (this.Active)
        {
            AudioSourceManager.PlayAudioClip(m_acMetronomeSound, false, 0.05f);                 // Play Metronome
            yield return(new WaitForSeconds(fWaitTime));                                        // Wait until next Beat to play next Metronome
        }
        m_MetronomeInstance = null;
    }
Exemple #10
0
    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    //	* Derived Method: Update
    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    void Update()
    {
        if (CheckForShake)
        {
#if UNITY_EDITOR
            UpdateShakeReveal();                                // Update Shake Visual Cue (If it is showing)
            m_ttRattleTimer.Update();                           // Update Rattle Timer (if the next shake exceeds this timer, then rattle must be reset)

            if (Input.GetKeyDown(KeyCode.LeftControl))
            {
                // If we did not cause a rattle sound
                if (!PerformRattleShakeCheck())
                {
                    // Make a shake sound
                    PerformTambShakeCheck();
                }
            }
            else
            {
                m_bSoundPlayed = false;
            }
#else
            UpdateAcceleration();                       // Update Movement Speed (Check Device Gyroscope)
            UpdateShakeReveal();                        // Update Shake Visual Cue (If it is showing)
            m_ttRattleTimer.Update();                   // Update Rattle Timer (if the next shake exceeds this timer, then rattle must be reset)

            // If we aren't already checking acceleration
            if (!m_bCheckingAcceleration)
            {
                // Have we at least STARTED moving?
                if (IsMoving())
                {
                    // GOOD. Make movement start noise!
                    AudioSourceManager.PlayAudioClip(m_rTambSoundManager.GetTambourineSound(TambourineSoundsManager.SoundTypes.MOVE_TAMBOURINE_SOUND));
                    m_bCheckingAcceleration = true;
                }
            }

            // If we are checking acceleration and it has been long enough since the last noise to make a new one. Check for shake
            if (m_bCheckingAcceleration && !m_bTimeout)
            {
                PerformTambShakeCheck();
            }

            // No movement? Don;t bother checking for shake.
            if (!IsMoving())
            {
                m_bSoundPlayed          = false;
                m_bCheckingAcceleration = false;
            }
#endif
        }
    }
Exemple #11
0
    private IEnumerator PlayChallengeBackingTrack(float delayTime = 0.0f)
    {
        if (delayTime > 0.0f)
        {
            yield return(new WaitForSeconds(delayTime));
        }

        // Challenge Hasn't been stopped during the delay?
        if (m_eChallengeActivity != ChallengeActivity.IDLE)
        {
            AudioSourceManager.PlayAudioClip(m_oChallengeBackingTrackInfo);
        }
    }
Exemple #12
0
 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 //	* New Callback Method: On "CONSECUTIVELY_STATIC_PRIORITY" Play Triggered
 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 private void OnConsecutivelyStaticPriorityPlayTriggered()
 {
     if (sm_iUsedAudioID == -1 || !AudioSourceManager.IsPlayingAudio(sm_iUsedAudioID))
     {
         sm_iUsedAudioID = AudioSourceManager.PlayAudioClip(m_acClipToPlay);
         LowerSceneBGM();
     }
     else if (AudioSourceManager.GetSelectedAudioClip(sm_iUsedAudioID) != m_acClipToPlay)
     {
         AudioSourceManager.StopAudio(sm_iUsedAudioID);
         sm_iUsedAudioID = AudioSourceManager.PlayAudioClip(m_acClipToPlay);
         LowerSceneBGM();
     }
 }
    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    //	* New Method: Invoke Unsuccessful Hit
    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    public void InvokeUnsuccessfulHit()
    {
        SprRend.sprite = m_sprMissedSprite;
        AudioSourceManager.PlayAudioClip(m_acMissedSound);

        if (!TutorialManager_Base.TutorialOpened)
        {
            m_rChallengeModeInfo.ChallengeScore -= 0.01f;
            m_rChallengeModeInfo.Score          -= 0.01f;
            m_rChallengeModeInfo.VisibleScore   -= 0.01f;
            m_rChallengeModeInfo.RemoveNote(this);
        }

        m_eMovementPhase = MovementPhase.MISS;
        m_fMissedTime    = Random.Range(0.0f, 10.0f);
    }
 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 //	* Derived Method: Play Button Sound
 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 public override void PlayButtonSound()
 {
     // If Challenge Not available... Play Buzzer ~
     if (m_acBuzzerSound != null)
     {
         if (m_eButtonAvailability != ButtonAvailability.AVAILABLE)
         {
             AudioSourceManager.PlayAudioClip(m_acBuzzerSound);
         }
         else
         {
             base.PlayButtonSound();
         }
     }
     else
     {
         base.PlayButtonSound();
     }
 }
    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    //	* New Method: Invoke Successful Hit
    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    public void InvokeSuccessfulHit()
    {
        SprRend.sprite = m_sprSuccessSprite;
        AudioSourceManager.PlayAudioClip(m_acHitSound);

        m_rChallengeModeInfo.Score += m_rChallengeModeInfo.NoteScore;
        m_rChallengeModeInfo.RemoveNote(this);
        // !!!Change the Score During Success Animation!!! //

        m_eSuccessAnimationPhase = SuccessAnimationPhase.TO_SCORE;

        if (m_eMovementPhase == MovementPhase.AUTO_PLAY)
        {
            LocalPosition.x = m_rChallengeModeInfo.victoryLocation.x;
        }
        m_arToScoreAnimation[0].m_vStartingPosition = LocalPosition;

        m_eMovementPhase           = MovementPhase.SUCCESS;
        m_iCurrentAnimationElement = 0;
    }
Exemple #16
0
    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    //	* New Method: Perform Tambourine Shake Check
    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    private void PerformTambShakeCheck()
    {
#if UNITY_EDITOR
        // Play Shake Sound unless it has already been played
        if (!m_bSoundPlayed)
        {
            AudioSourceManager.PlayAudioClip(m_rTambSoundManager.GetTambourineSound(TambourineSoundsManager.SoundTypes.HARD_TAMBOURINE_SHAKE));
            ShowShakenTambourine();
        }
        m_bSoundPlayed = true;
#else
        // If Hard Shake, then make hard shake sound if Rattle hasn't occured
        if (IsHardShake())
        {
            if (!PerformRattleShakeCheck())
            {
                if (!m_bSoundPlayed)
                {
                    AudioSourceManager.PlayAudioClip(m_rTambSoundManager.GetTambourineSound(TambourineSoundsManager.SoundTypes.HARD_TAMBOURINE_SHAKE));
                    ShowShakenTambourine();
                }
                m_bSoundPlayed = true;
            }
        }

        // If Soft Shake, then make soft shake sound if Rattle hasn't occured
        else if (IsSoftShake())
        {
            if (!PerformRattleShakeCheck())
            {
                if (!m_bSoundPlayed)
                {
                    AudioSourceManager.PlayAudioClip(m_rTambSoundManager.GetTambourineSound(TambourineSoundsManager.SoundTypes.SOFT_TAMBOURINE_SHAKE));
                    ShowShakenTambourine();
                }
                m_bSoundPlayed = true;
            }
        }
#endif
    }
Exemple #17
0
    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    //	* New Method: Show Rewarded Feathers Pop-up
    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    private IEnumerator ShowRewardedFeathersPopup(int iAwardedFeathersCount)
    {
        float fWaitTimeBetweenFeathers = 0.5f;
        int   iAccFeathers             = 0;;

        for (int i = 1; i <= iAwardedFeathersCount; ++i)
        {
            if (m_acFeatherGETSoundEffect != null)
            {
                AudioSourceManager.PlayAudioClip(m_acFeatherGETSoundEffect);
            }
            m_rFeathersPopupManager.ShowQuickDialoguePopup(this.transform);

            iAccFeathers = ChallengeFeathersInfo.PreviouslyAccumulatedFeathers + i;
            m_rChallengeFeatherNotificationText.text = "x" + (iAccFeathers < 10 ? "0" : "") + iAccFeathers.ToString();

            yield return(new WaitForSeconds(fWaitTimeBetweenFeathers));
        }
        m_eTransitionPhase = TransitionPhase.EXP_BAR;
        m_imgExperienceBarBackground.gameObject.SetActive(true);
        m_imgExperienceBar.gameObject.SetActive(true);
    }
Exemple #18
0
    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    //	* New Method: Fadein Tutorial
    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    protected IEnumerator FadeinTutorial()
    {
        // Fade in Tutorial BGM
        AudioSourceManager.PlayAudioClip(m_oAudioHandlerInfo);

        // Fade in Vignette First
        VignetteManager.TransitionVignette(CurrentVignetteInfo);
        while (VignetteManager.IsTransitioning)
        {
            yield return(new WaitForEndOfFrame());
        }

        // Now You can Fadein/Show the Tutorial TextBox
        m_rTextBoxTransitionEffect.Reveal(false, false);
        m_rTextBoxTransitionEffect.LockNoteObject();
        while (!m_rTextBoxTransitionEffect.IsCurrentlyActive)
        {
            yield return(new WaitForEndOfFrame());
        }

        ResetTutorial();
        OnTutorialFadeinComplete();
    }
Exemple #19
0
 public int PlayTambourineSound(InstrumentManager.InstrumentMode eTambourineType, SoundTypes eSoundType)
 {
     return(AudioSourceManager.PlayAudioClip(GetTambourineSound(eTambourineType, eSoundType)));
 }
Exemple #20
0
    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    //	* New Method: Update EXP Bar Transition
    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    private void UpdateEXPBarTransition()
    {
        if (m_bFadeinResults)
        {
            if (m_rExperienceBarAE[0].IsCompleted())
            {
                if (m_rExperienceBarAE[1].UpdateAnimation(m_fRevealAnimationSpeed))
                {
                    m_imgExperienceBar.fillAmount = m_fAcquiredScore;
                    m_rExperienceBarAE[0].Reset();
                    m_rExperienceBarAE[1].Reset();

                    // PLAY HAPPY/UNHAPPY SFX!
                    if (m_eReactionMode == ReactionMode.DEFEATED || m_eReactionMode == ReactionMode.OKAY)
                    {
                        if (m_acDissapointmentSFX != null)
                        {
                            AudioSourceManager.PlayAudioClip(m_acDissapointmentSFX);
                        }
                    }
                    else
                    {
                        if (m_acExcitedAudioClip != null)
                        {
                            AudioSourceManager.PlayAudioClip(m_acExcitedAudioClip);
                        }
                    }

                    // SHOWING 'UNLOCKED ITEM' INFO?
                    if (m_eUnlockedItem == UnlockedItems.NO_UNLOCKS)
                    {
                        m_eTransitionPhase = TransitionPhase.RESULTS_BUTTONS;
                        m_aResultsButtons[0].gameObject.SetActive(true);
                        m_aResultsButtons[1].gameObject.SetActive(true);
                        m_aResultsButtons[2].gameObject.SetActive(true);
                    }
                    else
                    {
                        m_eTransitionPhase = TransitionPhase.UNLOCK_NOTIFICATION;
                        m_rUnlockedItemsNotifierBounceAE.gameObject.SetActive(true);
                        m_aoUnlockedItemsText[(int)m_eUnlockedItem].ApplyEffects(m_rUnlockedItemsText);
                        if (m_acChallengeNotifierWhooshSFX != null)
                        {
                            AudioSourceManager.PlayAudioClip(m_acChallengeNotifierWhooshSFX);
                        }
                    }
                }
                else
                {
                    m_imgExperienceBar.fillAmount = Mathf.Lerp(0, m_fAcquiredScore, m_rExperienceBarAE[1].CompletionPercentage);
                }
            }
            else
            {
                m_rExperienceBarAE[0].UpdateAnimation(m_fRevealAnimationSpeed);
            }
        }
        else
        {
            if (m_rExperienceBarAE[1].IsCompleted())
            {
                if (m_rExperienceBarAE[0].ReverseUpdate(m_fDisappearAnimationSpeed))
                {
                    m_imgExperienceBar.fillAmount = 0.0f;
                    m_rExperienceBarAE[0].Reset();
                    m_rExperienceBarAE[1].Reset();
                    m_eTransitionPhase = TransitionPhase.REACTION_TEXT;
                    m_imgExperienceBarBackground.gameObject.SetActive(false);
                    m_imgExperienceBar.gameObject.SetActive(false);
                }
            }
            else
            {
                m_rExperienceBarAE[1].ReverseUpdate(m_fDisappearAnimationSpeed);
                m_imgExperienceBar.fillAmount = Mathf.Lerp(m_fAcquiredScore, 0, m_rExperienceBarAE[1].CompletionPercentage);
            }
        }
    }
Exemple #21
0
 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 //	* New Callback Method: On "Always" Play Triggered
 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 private void OnAlwaysPlayTriggered()
 {
     m_iProvidedAudioID = AudioSourceManager.PlayAudioClip(m_acClipToPlay);
     LowerSceneBGM();
 }