Пример #1
0
    /// <summary>
    /// 播放特殊枚举标注的音效
    /// </summary>
    /// <param name="ComboId">组合ID</param>
    /// <param name="type">类型</param>
    /// <param name="palce">第几人称</param>
    /// <param name="alreadyPrepare">是否已经 Prepare 加载了 一般给 false</param>
    /// <param name="point">位置</param>
    public static void PlaySound(int ComboId, WwiseMusicSpecialType type, WwiseMusicPalce palce, bool alreadyPrepare, Vector3 point, Action <SystemObject> playEndAction = null, SystemObject userEndData = null)
    {
        MsgPlaySpecialTypeMusicOrSound parame = new MsgPlaySpecialTypeMusicOrSound();

        parame.ComboId        = ComboId;
        parame.type           = type;
        parame.palce          = palce;
        parame.alreadyPrepare = alreadyPrepare;
        parame.point          = point;
        parame.UseSoundParent = false;
        parame.endAction      = playEndAction;
        parame.userEndData    = userEndData;
        GameFacade.Instance.SendNotification(NotificationName.MSG_SOUND_PLAY, parame);
    }
Пример #2
0
    public override void Execute(INotification notification)
    {
        //特殊枚举类型标记
        MsgPlaySpecialTypeMusicOrSound specialparame = notification.Body as MsgPlaySpecialTypeMusicOrSound;

        if (specialparame != null)
        {
            if (specialparame.UseSoundParent)
            {
                WwiseManager.PlaySpecialTypeMusicOrSound(specialparame.ComboId, specialparame.type, specialparame.palce, specialparame.alreadyPrepare, specialparame.SoundParent, specialparame.endAction, specialparame.userEndData);
            }
            else
            {
                WwiseManager.PlaySpecialTypeMusicOrSound(specialparame.ComboId, specialparame.type, specialparame.palce, specialparame.alreadyPrepare, specialparame.point, specialparame.endAction, specialparame.userEndData);
            }
        }

        //普通的
        MsgPlayMusicOrSound playparame = notification.Body as MsgPlayMusicOrSound;

        if (playparame != null)
        {
            if (playparame.UseSoundParent)
            {
                WwiseManager.PlayMusicOrSound(playparame.musicId, playparame.alreadyPrepare, playparame.SoundParent, playparame.endAction, playparame.userEndData);
            }
            else
            {
                WwiseManager.PlayMusicOrSound(playparame.musicId, playparame.alreadyPrepare, playparame.point, playparame.endAction, playparame.userEndData);
            }
        }

        //toggle 越界声音
        MsgPlayMusicOrSound_outLine outLineparame = notification.Body as MsgPlayMusicOrSound_outLine;

        if (outLineparame != null && outLineparame.OldSelectionObj != null && outLineparame.OldSelectionObj.activeInHierarchy)
        {
            UnityEngine.UI.ButtonWithSound buttonSoundSprite = outLineparame.OldSelectionObj.GetComponent <UnityEngine.UI.ButtonWithSound>();
            if (buttonSoundSprite != null)
            {
                buttonSoundSprite.PlayOutLineSound();
            }
        }
    }