public override bool UpdateInternal(ref Context context) { if (_looped && _playMode == RandomComponentPlayMode.RandomNoRepeat && _triggerMode == RandomComponentTriggerMode.Retrigger) { float realtimeDelta = FabricTimer.GetRealtimeDelta(); _retriggerTimer += realtimeDelta; if (_retriggerTimer >= _retriggerTime) { _componentInstance._instance.SetPlayScheduled(_retriggerTimer - _retriggerTime, 0.0); PlayRandomomponent(_componentInstance); _retriggerTime = _delay + UnityEngine.Random.Range(_delayRandomization, _delayMaxRandomization); _retriggerTimer = 0f; } } return(base.UpdateInternal(ref context)); }
public void Update() { for (int i = 0; i < _eventQueue.Count; i++) { Fabric.Event @event = _eventQueue[i]; if (@event._delayTimer < @event._delay) { @event._delayTimer += FabricTimer.GetRealtimeDelta(); continue; } ProcessEvent(@event); @event._delay = 0f; @event._delayTimer = 0f; @event.eventStatus = EventStatus.Handled; _eventQueue.RemoveAt(i); } }
public void UpdateInternal() { float realtimeDelta = FabricTimer.GetRealtimeDelta(); if (_direction > 0f) { _seekTarget += _velocity * realtimeDelta; } else { _seekTarget -= _velocity * realtimeDelta; } _markers.Update(_seekTarget, _direction); if (_markers.IsMarkerKeyOff()) { _seekTarget = _markers._keyOffMarker._value; } if (_velocity != 0f) { if (_seekTarget > MAX_NORMALISED_RANGE) { if (_loopBehaviour == ParameterLoopBehaviour.Loop) { _seekTarget -= MAX_NORMALISED_RANGE - MIN_NORMALISED_RANGE; } else if (_loopBehaviour == ParameterLoopBehaviour.OneShot) { _seekTarget = MAX_NORMALISED_RANGE; } else if (_loopBehaviour == ParameterLoopBehaviour.PingPong) { _direction = -1f; } else { _seekTarget = MAX_NORMALISED_RANGE; } _markers.Reset(); } else if (_seekTarget < MIN_NORMALISED_RANGE) { if (_loopBehaviour == ParameterLoopBehaviour.Loop) { _seekTarget += MAX_NORMALISED_RANGE - MIN_NORMALISED_RANGE; } else if (_loopBehaviour == ParameterLoopBehaviour.OneShot) { _seekTarget = MIN_NORMALISED_RANGE; } else if (_loopBehaviour == ParameterLoopBehaviour.PingPong) { _direction = 1f; } else { _seekTarget = MIN_NORMALISED_RANGE; } _markers.Reset(); } if (_seekTarget > MAX_NORMALISED_RANGE) { _seekTarget = MAX_NORMALISED_RANGE; } else if (_seekTarget < MIN_NORMALISED_RANGE) { _seekTarget = MIN_NORMALISED_RANGE; } } if (_seekSpeed != 0f) { float num = _seekSpeed * realtimeDelta; if (_seekTarget > _value) { _value += num; if (_value > _seekTarget) { _value = _seekTarget; } } else if (_seekTarget < _value) { _value -= num; if (_value < _seekTarget) { _value = _seekTarget; } } } else { _value = _seekTarget; } AudioTools.Limit(ref _value, 0f, 1f); }