/// <summary> /// Win sound play when meter running, spining speed will reflected to sound length. /// </summary> /// <param name="_meterSpeed"> meter spining speed. </param> /// <param name="_delayTime"> delay time. </param> public void PlayWinSound(ref float _meterSpeed, float _delayTime = 0f) { if (GameVariables.Instance.IS_INCRESED) return; // Silence win sound in free game. if (GameVariables.Instance.IS_FREEGAME && FreeGame.Instance.FG_LEFT > 0) { int wS = ComputeWinMusicIndex (); string _name = "LineWin" + wS.ToString (); m_WinSound = new OTSound(_name).Play ().Delay(_delayTime); m_Duration = m_WinSound.GetSoundDuration(); m_WinSound.Stop(); _meterSpeed = WinManager.Instance.TOTALWIN / m_Duration; return; } //! update meter spped no matter the game is in main or free game. if(WinManager.Instance.Is_BigWin()) { string _name = "BigWin"; if(m_SoundLists.Add (_name)) { m_Timer = 0; m_WinSound = new OTSound(_name).Play ().Delay(_delayTime).Loop(); m_Duration = m_WinSound.GetSoundDuration() * 2; //GoldCoinEmitter.Instance.StartGoldCoinAnimation(); } m_Timer += Time.deltaTime; _meterSpeed = 50 * GameVariables.Instance.GetCreditPerLine(); if(m_Timer > m_Duration/2) _meterSpeed = AdjustSpeed (m_Timer, m_Duration); } else { //! Norma win sound case: int wS = ComputeWinMusicIndex (); string _name = "LineWin" + wS.ToString (); if(m_SoundLists.Add (_name)) { m_Timer = 0f; //! Play selected win sound and win tail. m_WinSound = new OTSound(_name).Play ().Delay(_delayTime); m_Duration = m_WinSound.GetSoundDuration(); if(wS >= 9 && wS <= 30) m_WinTailSound.Play ().Delay(m_Duration); } m_Timer += Time.deltaTime; _meterSpeed = WinManager.Instance.TOTALWIN / m_Duration; //AdjustSpeed (m_Timer, m_Duration); } if (m_Timer > m_Duration) GameVariables.Instance.IS_INCRESED = true; }