Example #1
0
    AudioClip GetClipForState(SMusicState pState)
    {
        Debug.Log("Music requested: " + pState);
        AudioClip ac = pState.GetNextClip();

        return(ac);
    }
Example #2
0
    /// <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);
    }
Example #3
0
    public void StopAllClips(bool pImmediately)
    {
        currentState = SMusicState.invalid;

        if (mCurrentChannel != null)
        {
            Stop(mCurrentChannel, pImmediately);
        }
    }
Example #4
0
    public void PlayClip(SMusicState pState)
    {
        if (currentState != pState)
        {
            Debug.Log("GameMusic: " + pState);

            AudioClip _requestedClip = GetClipForState(pState);
            mCurrentChannel = Play(_requestedClip, true);
            currentState    = pState;
        }
    }
Example #5
0
    void Start()
    {
        currentState = SMusicState.invalid;

        if (mInitialized)
        {
            return;
        }
#if UNITY_ANDROID
        Init(1);
#else
        Init(3);
#endif
        fadeDuration = mFadeTime;

        mInitialized = true;
        GOptions.OnAnyOptionChanged += OnAnyOptionChangedEvent;
    }
Example #6
0
 public bool Equals(SMusicState pState)
 {
     return(pState.mIndex == this.mIndex);
 }