void FinishPlay_Once_Cycle() { if( Time.time - m_BeginTime > m_Length) { m_BeginTime = Time.time; m_State = eSoundState.Before_Play; } }
void BeforePlay() { float time = GetProceedTime(); if( time > m_Timing) { switch( m_ActionSound.LoopType) { case eLoopType.Once: m_Sound = AsSoundManager.Instance.PlaySound( m_ActionSound.FileName, m_EntityTrn.position, false); break; case eLoopType.Once_Cycle: if(m_Sound == null) { m_Sound = AsSoundManager.Instance.PlaySound( m_ActionSound.FileName, m_EntityTrn.position, false); if(m_Sound != null) GameObject.Destroy( m_Sound.GetComponent<AsSoundObject>()); // else // Debug.LogError("SoundProcessor::BeforePlay: '" + m_ActionSound.FileName + "' is not found"); } else { m_Sound.Play(); } break; case eLoopType.Loop: m_Sound = AsSoundManager.Instance.PlaySound( m_ActionSound.FileName, m_EntityTrn.position, true); break; } m_State = eSoundState.After_Play; } }
void AfterPlay_Once_Cycle() { // m_SoundBegan += Time.time; // // if( m_SoundBegan > m_Sound.clip.length) // { // m_SoundBegan = 0f; // Debug.Log("AfterPlay_Once_Cycle: " + m_Sound.name + " : " + m_SoundBegan); // // m_Sound.mute = true; // m_State = eSoundState.Finish_Play; // } // if( m_Sound.isPlaying == false) // { m_State = eSoundState.Finish_Play; // } }