public override void OnBehaviourPlay(Playable playable, FrameData info)
{
if (!Application.isPlaying)
{
return;
}
foreach (var val in Director.playableAsset.outputs)
{
if (!bindingDict.ContainsKey(val.streamName))
{
bindingDict.Add(val.streamName, val);
}
}
CinemachineBrain brain = FirstPersonMainCamera.instance.MainCamera.GetComponent<CinemachineBrain>();
if(brain != null)
{
brain.enabled = true;
Director.SetGenericBinding(bindingDict[TrackName].sourceObject, brain);
CinemachineTrack track = bindingDict[TrackName].sourceObject as CinemachineTrack;
var clips = track.GetClips();
foreach(var val in clips)
{
var clip = val.asset as CinemachineShot;// CinemachineVirtualCamera;
if(clip != null)
{
CinemachineVirtualCameraBase vCam = (CinemachineVirtualCameraBase)clip.VirtualCamera.Resolve(playable.GetGraph().GetResolver());
if (vCam.Follow != null)
{
vCam.Follow = FirstPersonMainCamera.instance.FollowTarget;
Debug.Log("clip.Follow = " + vCam.Follow);
}
if (vCam.LookAt != null)
{
vCam.LookAt = FirstPersonMainCamera.instance.LookAtTarget;
Debug.Log("clip.LookAt = " + vCam.LookAt);
}
}
}
}
}