public static float IncrementParameter(this StudioEventEmitter e, string name, float val) { float p = e.GetParameter(name) + val; e.SetParameter(name, p); return(p); }
private void Update() { if (Time.time > setStateTime + states[currentState].duration) { currentState = defaultState; } currentValue = target.GetParameter(parameterName); currentValue += states[currentState].speed * Time.deltaTime; currentValue = Mathf.Clamp(currentValue, clampMin, clampMax); target.SetParameter(parameterName, currentValue); }
public float GetParameter() { return(target.GetParameter(parameterName)); }
private void InternalUpdate() { ++updateCount; if (updateCount < startDelay) { return; } var source = SourceProvider <float> .GetValueProvider(valueSource, this); if (source == null) { return; } if (updateCount == startDelay) { source.InitValue(); } rawValue = source.GetValue(); float targetValue = rawValue * adjust.scale + adjust.bias; targetValue = Mathf.Clamp(targetValue, adjust.clampMin, adjust.clampMax); if (adjust.useCurve) { targetValue = adjust.curve.Evaluate(targetValue); } if (!string.IsNullOrEmpty(parameterName)) { currentValue = target.GetParameter(parameterName); } currentValue = adjust.smoothing > 0 ? Mathf.MoveTowards(currentValue, targetValue, Time.deltaTime / adjust.smoothing) : targetValue; if (target != null) { if (!string.IsNullOrEmpty(parameterName)) { target.SetParameter(parameterName, currentValue); } if (playOnlyWhenNonZero) { if (target.IsPlaying()) { if (currentValue == 0) { target.Stop(); } } else { if (currentValue != 0) { target.Play(); } } } } }