Beispiel #1
0
 public override void PreStart()
 {
     this.mHandleSE = MySound.CueSheetHandle.Create(Event2dAction_SELoop.SECueSheetName, MySound.EType.SE, true, true, false, false);
     if (this.mHandleSE == null)
     {
         return;
     }
     this.mHandleSE.CreateDefaultOneShotSource();
     Event2dAction_SELoop.instances.Add(this);
 }
Beispiel #2
0
 protected override void OnDestroy()
 {
     if (this.mPlayHandle != null)
     {
         this.mPlayHandle.Stop(this.FadeOutSec);
         this.mPlayHandle = (MySound.PlayHandle)null;
     }
     if (this.mHandle != null)
     {
         this.mHandle.StopDefaultAll(this.FadeOutSec);
         this.mHandle = (MySound.CueSheetHandle)null;
     }
     base.OnDestroy();
 }
Beispiel #3
0
 private void OnDestroy()
 {
     if (this.mPlayHandle != null)
     {
         this.mPlayHandle.Stop(this.mFadeOutSec);
         this.mPlayHandle = (MySound.PlayHandle)null;
     }
     if (this.mHandle == null)
     {
         return;
     }
     this.mHandle.StopDefaultAll(this.mFadeOutSec);
     this.mHandle = (MySound.CueSheetHandle)null;
 }
Beispiel #4
0
 public void Setup(string sheetName, string cueID, MySound.EType type, int repeatCount, float repeatWait, float stopSec, float fadeOutSec, bool useCustom, MySound.CueSheetHandle.ELoopFlag customLoopFlag, float customDelaySec)
 {
     this.mCueID          = cueID;
     this.mPlayCount      = repeatCount + 1;
     this.RepeatWait      = repeatWait;
     this.mStopSec        = stopSec;
     this.mStop           = (double)stopSec > 0.0;
     this.mFadeOutSec     = fadeOutSec;
     this.mUseCustomPlay  = useCustom;
     this.mCustomLoopFlag = customLoopFlag;
     this.mCustomDelaySec = customDelaySec;
     this.mHandle         = MySound.CueSheetHandle.Create(sheetName, type, true, true, false);
     this.mHandle.CreateDefaultOneShotSource();
 }
Beispiel #5
0
 public override void OnActivate(int pinID)
 {
     if (this.RepeatCount > 0 || (double)this.StopSec > 0.0)
     {
         GameObject gameObject = new GameObject("PlaySERepeat", new System.Type[1]
         {
             typeof(PlaySERepeat)
         });
         PlaySERepeat component = (PlaySERepeat)gameObject.GetComponent <PlaySERepeat>();
         if (Object.op_Equality((Object)component, (Object)null))
         {
             Object.Destroy((Object)gameObject);
         }
         else
         {
             component.Setup(this.mSheetName, this.cueID, this.Type, this.RepeatCount, this.RepeatWait, this.StopSec, this.FadeOutSec, this.UseCustomPlay, this.CustomLoopFlag, this.CustomDelaySec);
             if (this.FadeOutOnDestroy)
             {
                 gameObject.get_transform().set_parent(((Component)this).get_gameObject().get_transform());
             }
             else
             {
                 Object.DontDestroyOnLoad((Object)gameObject);
             }
         }
     }
     else if (!this.FadeOutOnDestroy)
     {
         MonoSingleton <MySound> .Instance.PlayOneShot(this.mSheetName, this.cueID, this.Type, 0.0f);
     }
     else
     {
         this.mHandle = MySound.CueSheetHandle.Create(this.mSheetName, this.Type, true, true, false);
         if (this.mHandle != null)
         {
             if (this.UseCustomPlay)
             {
                 this.mPlayHandle = this.mHandle.Play(this.cueID, this.CustomLoopFlag, true, this.CustomDelaySec);
             }
             else
             {
                 this.mHandle.CreateDefaultOneShotSource();
                 this.mHandle.PlayDefaultOneShot(this.cueID, false, 0.0f);
             }
         }
     }
     this.ActivateOutputLinks(1);
 }
Beispiel #6
0
 private void Update()
 {
     if (this.mStop)
     {
         this.mStopSec -= Time.get_unscaledDeltaTime();
         if ((double)this.mStopSec <= 0.0)
         {
             if (this.mPlayHandle != null)
             {
                 this.mPlayHandle.Stop(this.mFadeOutSec);
                 this.mPlayHandle = (MySound.PlayHandle)null;
             }
             if (this.mHandle != null)
             {
                 this.mHandle.StopDefaultAll(this.mFadeOutSec);
                 this.mHandle = (MySound.CueSheetHandle)null;
             }
             Object.Destroy((Object)((Component)this).get_gameObject());
             return;
         }
     }
     if (this.mPlayCount <= 0)
     {
         return;
     }
     this.mRepeatWait -= Time.get_unscaledDeltaTime();
     if ((double)this.mRepeatWait > 0.0)
     {
         return;
     }
     if (this.mUseCustomPlay)
     {
         this.mPlayHandle = this.mHandle.Play(this.mCueID, this.mCustomLoopFlag, false, this.mCustomDelaySec);
     }
     else
     {
         this.mHandle.PlayDefaultOneShot(this.mCueID, false, 0.0f);
     }
     this.mRepeatWait = this.RepeatWait;
     --this.mPlayCount;
     if (this.mStop || this.mPlayCount > 0)
     {
         return;
     }
     Object.Destroy((Object)((Component)this).get_gameObject());
 }