コード例 #1
0
    private void FillAnimation(AnimationClip clip)
    {
#if !UNITY_3_5
        clip.legacy = _useLagacyAnimations;
#endif

        FlowController.GetInformers().ForEach(informer => {
            var localPosition = informer.transform.localPosition;
            var path          = AnimationUtility.CalculateTransformPath(informer.transform, FlowController.transform);
            clip.SetCurve(path, typeof(Transform), "localPosition.x",
                          AnimationCurve.Linear(0, localPosition.x, _videoLength, localPosition.x));
            clip.SetCurve(path, typeof(Transform), "localPosition.y",
                          AnimationCurve.Linear(0, localPosition.y, _videoLength, localPosition.y));
            clip.SetCurve(path, typeof(Transform), "localPosition.z",
                          AnimationCurve.Linear(0, localPosition.z, _videoLength, localPosition.z));
        });
    }