Example #1
0
        public void AddKey(float time, ref Vector3 vp, ref Quaternion vr, ref Vector3 vs, GOECurvInterpolationType pt = GOECurvInterpolationType.Linear, GOECurvInterpolationType rt = GOECurvInterpolationType.Linear, GOECurvInterpolationType st = GOECurvInterpolationType.Linear)
        {
            GOECurvKeyFrame kf = new GOECurvKeyFrame();

            kf.Time     = time;
            kf.Position = vp;
            kf.Rotation = vr;
            kf.Scale    = vs;
            kf.PositionInterpolationType = pt;
            kf.RotationInterpolationType = rt;
            kf.ScaleInterpolationType    = st;

            int left, right;
            GOECurveFindIndexResults b = FindIndexByTime(time, out left, out right);

            if (b == GOECurveFindIndexResults.AfterAllKeyFrame || b == GOECurveFindIndexResults.FailedNoKeyFrame)
            {
                keyFrames.Add(kf);
            }
            else if (b == GOECurveFindIndexResults.BeforeAllKeyFrame)
            {
                KeyFrames.Insert(0, kf);
            }
            else
            {
                keyFrames.Insert(left + 1, kf);
            }

            if (EditorGameObject)
            {
                kf.EnsureEditorGO(EditorGameObject);
                UnityEditor.Selection.activeGameObject = kf.EditorGameObject;
            }
        }