AudioClip GetClipForState(SMusicState pState) { Debug.Log("Music requested: " + pState); AudioClip ac = pState.GetNextClip(); return(ac); }
/// <summary> /// Add a new Music State to the central music state system. You can add clips to the returns instance. /// </summary> /// <param name="pIndex">index.</param> /// <param name="pName">name.</param> /// <returns>The static instance for the given index. </returns> public static SMusicState Add(int pIndex, string pName) { var state = new SMusicState(pIndex, pName); mStates.Add(pIndex, state); return(state); }
public void StopAllClips(bool pImmediately) { currentState = SMusicState.invalid; if (mCurrentChannel != null) { Stop(mCurrentChannel, pImmediately); } }
public void PlayClip(SMusicState pState) { if (currentState != pState) { Debug.Log("GameMusic: " + pState); AudioClip _requestedClip = GetClipForState(pState); mCurrentChannel = Play(_requestedClip, true); currentState = pState; } }
void Start() { currentState = SMusicState.invalid; if (mInitialized) { return; } #if UNITY_ANDROID Init(1); #else Init(3); #endif fadeDuration = mFadeTime; mInitialized = true; GOptions.OnAnyOptionChanged += OnAnyOptionChangedEvent; }
public bool Equals(SMusicState pState) { return(pState.mIndex == this.mIndex); }