IEnumerator ChangeVolumes() { while (true) { yield return(new WaitForSeconds(heroCheckPeriodSec)); FloatPair vol_hp = volumeMinMaxsDependingOnHP[HeroDefiner.currentHero.HPController.HP]; Vector3 pastPos = HeroDefiner.PastPoss.Count > 0 ? HeroDefiner.PastPoss[(int)(heroCheckPeriodSec * 60)] : new Vector3(); float vol_speed = (HeroDefiner.CurrentPos - pastPos) .magnitude / (heroCheckPeriodSec * 60) / 20; float actualVolume = Mathf.Lerp(vol_hp.Min, vol_hp.Max, vol_speed); actualVal = actualVolume; foreach (var windName in windNames) { soundGroup.VolumeTo(windName, actualVolume, heroCheckPeriodSec); } } }
// used to pass.Value to other instace of this class public void PassValue(FloatPair floatPair) { target = floatPair.target; effector = floatPair.effector; useRange = floatPair.useRange; min = floatPair.min; max = floatPair.max; useExternalEeffector = floatPair.useExternalEeffector; externalEffector = floatPair.externalEffector; }