////////////////////////////////////////////////////////////////////////// // CONSTRUCTORS ////////////////////////////////////////////////////////////////////////// //----------------------------------------------------------------------- public AnimationTrack(string name, Animation parent) { this.name = name; this.parent = parent; maxFrameTime = 0; keyframes = new List<AnimationKeyFrame>(); }
private static Animation CreateAnimation(SerializableAnimation animationContent) { Animation animation = new Animation(animationContent.name); animation.SetLength(animationContent.length); foreach (SerializableTrack trackContent in animationContent.tracks) { AnimationTrack track = animation.CreateTrack(trackContent.name); for (int i = 0; i < trackContent.keyframes.Count; i++) { SerializableKeyFrame keyFrameContent = trackContent.keyframes[i]; AnimationKeyFrame keyFrame = new AnimationKeyFrame { rotation = keyFrameContent.rotation, scale = keyFrameContent.scale, translation = keyFrameContent.translation, time = keyFrameContent.time }; track.AddKeyFrame(keyFrame); } } return animation; }
////////////////////////////////////////////////////////////////////////// // CONSTRUCTORS ////////////////////////////////////////////////////////////////////////// //----------------------------------------------------------------------- public AnimationState(Animation animation) { this.animation = animation; length = animation.GetLength(); curr_position = 0; weight = 1; speed = 1.0f; curr_position = 0; prev_position = 0; looping = false; paused = false; active = false; fade_step = 0; }
//----------------------------------------------------------------------- public void AddAnimation(Animation animation) { animationList.Add(animation); animationIndexByName.Add(animation.GetName(), animationList.Count - 1); }