Пример #1
0
 public void SetDefaultParameter(float value)
 {
     if (FMOD_StudioEventEmitter.IsParameterValid(this.defaultParameter))
     {
         UnityUtil.ERRCHECK(this.defaultParameter.setValue(value));
     }
 }
Пример #2
0
 public void StartEvent()
 {
     if (!this.hasStarted)
     {
         if (!this.IsEventInstanceValid())
         {
             this.CacheEventInstance();
         }
         if (this.IsEventInstanceValid())
         {
             this.Update3DAttributes();
             if (FMOD_StudioEventEmitter.IsParameterValid(this.timeParameter))
             {
                 this.ERRCHECK(this.timeParameter.setValue(FMOD_StudioEventEmitter.HoursSinceMidnight));
             }
             if (FMOD_StudioEventEmitter.IsParameterValid(this.windParameter))
             {
                 this.ERRCHECK(this.windParameter.setValue(FMOD_StudioEventEmitter.WindIntensity));
             }
             if (this.preStartAction != null)
             {
                 this.preStartAction(this.evt);
             }
             if (this.sendPreprocessMessage)
             {
                 base.SendMessage("PreprocessFMODEvent", this.evt, SendMessageOptions.DontRequireReceiver);
             }
             this.ERRCHECK(this.evt.start());
             this.hasStarted = true;
         }
         else
         {
             UnityUtil.LogError("Event retrieval failed: '" + this.path + "'");
         }
     }
 }
Пример #3
0
 private void Update()
 {
     if (!this.IsEventDescriptionValid())
     {
         return;
     }
     if (!this.ShouldCacheOnAwake() && FMOD_StudioEventEmitter.LocalPlayerTransform)
     {
         float sqrMagnitude = (FMOD_StudioEventEmitter.LocalPlayerTransform.position - base.transform.position).sqrMagnitude;
         if (this.IsEventInstanceValid())
         {
             if (sqrMagnitude > this.triggerRadiusSquared * 4f)
             {
                 UnityUtil.ERRCHECK(this.evt.stop(STOP_MODE.ALLOWFADEOUT));
                 UnityUtil.ERRCHECK(this.evt.release());
                 this.evt = null;
             }
         }
         else if (sqrMagnitude < this.triggerRadiusSquared * 2.25f)
         {
             this.CacheEventInstance();
         }
         if (this.triggerType == FMOD_StudioEventEmitter.TriggerType.EventMaximumDistance)
         {
             if (this.withinTriggerRadius && sqrMagnitude > this.triggerRadiusSquared)
             {
                 this.withinTriggerRadius = false;
                 this.Stop();
             }
             else if (!this.withinTriggerRadius && sqrMagnitude <= this.triggerRadiusSquared)
             {
                 this.withinTriggerRadius = true;
                 base.StartCoroutine("StartEventWhenStopped");
             }
         }
     }
     if (this.IsEventInstanceValid())
     {
         if (base.transform.hasChanged)
         {
             this.Update3DAttributes();
             if (!this.isMoving)
             {
                 FMOD_StudioEventEmitterManager.Add(this);
                 this.isMoving = true;
             }
         }
         if (FMOD_StudioEventEmitter.IsParameterValid(this.timeParameter))
         {
             this.ERRCHECK(this.timeParameter.setValue(FMOD_StudioEventEmitter.HoursSinceMidnight));
         }
         if (FMOD_StudioEventEmitter.IsParameterValid(this.windParameter))
         {
             this.ERRCHECK(this.windParameter.setValue(FMOD_StudioEventEmitter.WindIntensity));
         }
     }
     else
     {
         this.evt = null;
     }
 }