void UpdateRTPCs() { RTPCDict = new Dictionary <string, RTPC>(); List <RTPC> rtpcs = new List <RTPC>(); if (AudioPlayerOld.Instance != null) { if (AudioPlayerOld.Instance.rTPCs != null) { if (rTPCs == null) { rTPCs = new RTPC[0]; } for (int i = 0; i < AudioPlayerOld.Instance.rTPCs.Length; i++) { if (i < rTPCs.Length) { rTPCs[i].name = AudioPlayerOld.Instance.rTPCs[i].name; rTPCs[i].volume.name = "Volume"; rTPCs[i].pitch.name = "Pitch"; rtpcs.Add(rTPCs[i]); } else { RTPC newRTPC = new RTPC(); newRTPC.name = AudioPlayerOld.Instance.rTPCs[i].name; newRTPC.volume = new RTPCParameter(); newRTPC.volume.name = "Volume"; newRTPC.volume.curve = new AnimationCurve(new Keyframe[2] { new Keyframe(0, 0), new Keyframe(1, 1) }); newRTPC.pitch = new RTPCParameter(); newRTPC.pitch.name = "Pitch"; newRTPC.pitch.curve = new AnimationCurve(new Keyframe[2] { new Keyframe(0, 0), new Keyframe(1, 1) }); rtpcs.Add(newRTPC); } } rTPCs = rtpcs.ToArray(); foreach (RTPC rtpc in rTPCs) { RTPCDict[rtpc.name] = rtpc; } } } }
public override void ProcessFrame(UnityEngine.Playables.Playable playable, UnityEngine.Playables.FrameData frameData, object playerData) { base.ProcessFrame(playable, frameData, playerData); if (RTPC == null) { return; } var obj = playerData as UnityEngine.GameObject; if (obj != null) { gameObject = obj; } if (setGlobally) { RTPC.SetGlobalValue(value); } else if (gameObject) { RTPC.SetValue(gameObject, value); } }