protected override void DoCopy(Track track) { TranslationTrack ntrack = track as TranslationTrack; ntrack._obj = _obj; ntrack.cachedInitialPosition = cachedInitialPosition; ntrack.pixelSnap = pixelSnap; ntrack.pixelPerUnit = pixelPerUnit; }
/// <summary> /// Generate path points and endFrame. keyInd is the index of this key in the track. /// </summary> public void GeneratePath(TranslationTrack track, int keyInd) { switch (interp) { case Interpolation.None: path = new Vector3[0]; endFrame = keyInd + 1 < track.keys.Count ? track.keys[keyInd + 1].frame : frame; break; case Interpolation.Linear: if (keyInd + 1 < track.keys.Count) { path = new Vector3[2]; path[0] = position; var nextKey = (TranslationKey)track.keys[keyInd + 1]; path[1] = nextKey.position; endFrame = nextKey.frame; } else //fail-safe { path = new Vector3[0]; endFrame = frame; } break; case Interpolation.Curve: var pathList = new List <Vector3>(); for (int i = keyInd; i < track.keys.Count; i++) { var key = (TranslationKey)track.keys[i]; pathList.Add(key.position); endFrame = key.frame; if (key.interp != Interpolation.Curve) { break; } } if (pathList.Count > 1) { path = pathList.ToArray(); } else { path = new Vector3[0]; } break; } }