Exemple #1
0
        protected override void LoadStateLocomotionVoice(int stateHashName)
        {
            int voiceID;

            if (Object.op_Equality((Object)(this.Actor as AgentActor), (Object)null) || !Singleton <Resources> .Instance.Action.AgentLocomotionBreathTable.TryGetValue(stateHashName, out voiceID) || this._loopActionVoice.Item1 == voiceID && Object.op_Inequality((Object)this._loopActionVoice.Item2, (Object)null))
            {
                return;
            }
            int             personality = this.Actor.ChaControl.fileParam.personality;
            AssetBundleInfo info;

            if (!Singleton <Resources> .Instance.Sound.TryGetMapActionVoiceInfo(personality, voiceID, out info))
            {
                return;
            }
            Transform transform1 = ((Component)this.Actor.Locomotor).get_transform();

            Manager.Voice instance        = Singleton <Manager.Voice> .Instance;
            int           num             = personality;
            string        assetbundle     = (string)info.assetbundle;
            string        asset           = (string)info.asset;
            Transform     transform2      = transform1;
            int           no              = num;
            string        assetBundleName = assetbundle;
            string        assetName       = asset;
            Transform     voiceTrans      = transform2;
            Transform     trfVoice        = instance.OnecePlayChara(no, assetBundleName, assetName, 1f, 0.0f, 0.0f, true, voiceTrans, Manager.Voice.Type.PCM, -1, false, true, false);

            this.Actor.ChaControl.SetVoiceTransform(trfVoice);
            this._loopActionVoice.Item1 = (__Null)voiceID;
            this._loopActionVoice.Item2 = (__Null)((Component)trfVoice).GetComponent <AudioSource>();
            this._loopActionVoice.Item3 = (__Null)transform1;
            this._loopActionVoice.Item4 = (__Null)personality;
        }
Exemple #2
0
        protected override bool PlayEventLoopVoice()
        {
            if (!base.PlayEventLoopVoice())
            {
                return(false);
            }
            AgentActor actor = this.Actor as AgentActor;

            if (Object.op_Equality((Object)actor, (Object)null))
            {
                return(false);
            }
            int stateLoopVoiceEvent = this.StateLoopVoiceEvents[Random.Range(0, this.StateLoopVoiceEvents.Count)];

            if (this._loopActionVoice.Item1 == stateLoopVoiceEvent && Object.op_Inequality((Object)this._loopActionVoice.Item2, (Object)null))
            {
                return(false);
            }
            int             personality = actor.ChaControl.fileParam.personality;
            AssetBundleInfo info;

            if (!Singleton <Resources> .Instance.Sound.TryGetMapActionVoiceInfo(personality, stateLoopVoiceEvent, out info))
            {
                return(false);
            }
            Transform transform1 = ((Component)this.Actor.Locomotor).get_transform();

            Manager.Voice instance        = Singleton <Manager.Voice> .Instance;
            int           num             = personality;
            string        assetbundle     = (string)info.assetbundle;
            string        asset           = (string)info.asset;
            Transform     transform2      = transform1;
            int           no              = num;
            string        assetBundleName = assetbundle;
            string        assetName       = asset;
            Transform     voiceTrans      = transform2;
            Transform     trfVoice        = instance.OnecePlayChara(no, assetBundleName, assetName, 1f, 0.0f, 0.0f, true, voiceTrans, Manager.Voice.Type.PCM, -1, false, true, false);

            this.Actor.ChaControl.SetVoiceTransform(trfVoice);
            this._loopActionVoice.Item1 = (__Null)stateLoopVoiceEvent;
            this._loopActionVoice.Item2 = (__Null)((Component)trfVoice).GetComponent <AudioSource>();
            this._loopActionVoice.Item3 = (__Null)transform1;
            this._loopActionVoice.Item4 = (__Null)personality;
            return(Object.op_Inequality((Object)this._loopActionVoice.Item2, (Object)null));
        }
Exemple #3
0
        protected override void PlayEventOnceVoice(int voiceID)
        {
            AgentActor actor = this.Actor as AgentActor;

            if (Object.op_Equality((Object)actor, (Object)null))
            {
                return;
            }
            int             personality = actor.ChaControl.fileParam.personality;
            AssetBundleInfo info;

            if (!Singleton <Resources> .Instance.Sound.TryGetMapActionVoiceInfo(personality, voiceID, out info))
            {
                return;
            }
            Transform transform1 = ((Component)this.Actor.Locomotor).get_transform();

            Manager.Voice instance        = Singleton <Manager.Voice> .Instance;
            int           num             = personality;
            string        assetbundle     = (string)info.assetbundle;
            string        asset           = (string)info.asset;
            Transform     transform2      = transform1;
            int           no              = num;
            string        assetBundleName = assetbundle;
            string        assetName       = asset;
            Transform     voiceTrans      = transform2;
            Transform     trfVoice        = instance.OnecePlayChara(no, assetBundleName, assetName, 1f, 0.0f, 0.0f, true, voiceTrans, Manager.Voice.Type.PCM, -1, true, true, false);

            this.Actor.ChaControl.SetVoiceTransform(trfVoice);
            this.OnceActionVoice = (AudioSource)((Component)trfVoice).GetComponent <AudioSource>();
            if (!Object.op_Inequality((Object)this.OnceActionVoice, (Object)null))
            {
                return;
            }
            ObservableExtensions.Subscribe <Unit>(Observable.TakeUntilDestroy <Unit>((IObservable <M0>)ObservableTriggerExtensions.OnDestroyAsObservable((Component)this.OnceActionVoice), ((Component)this).get_gameObject()), (Action <M0>)(_ =>
            {
                if (this.PlayEventLoopVoice())
                {
                    return;
                }
                this.StopLoopActionVoice();
            }));
        }