public AnimationClip(string name, ClipBone[] clipBones, ModelViewerAux.AnimationClip clip) { Name = name; ClipBones = clipBones; Clip = clip; }
public AnimationClip AddAnimationClip(string name) { AnimatorInfo clip = null; if (animationClips.TryGetValue (name, out clip)) { return new AnimationClip (name, clip.ClipBones, clip.ModelExtra.Clips[0]); } #if BIONICK Model model = Bionick.Game.Base.Game.Instance.Content.Load<Model>("Models/Animation/" + name); #else Model model = game.Content.Load<Model>("Animations/" + name); #endif if (model == null) return null; ModelExtra extra = model.Tag as ModelExtra; if (extra == null) return null; if (extra.Clips.Count != 1) return null; int boneCount = extra.Clips[0].Bones.Count; ClipBone[] clipBones = new ClipBone[boneCount]; for(int i = 0; i < clipBones.Length; i++) { ModelViewerAux.AnimationClip.Bone bone = extra.Clips[0].Bones[i]; clipBones[i] = new ClipBone(bone, FindBone(bone.Name)); } clip = new AnimatorInfo (); clip.ModelExtra = extra; clip.ClipBones = clipBones; animationClips.Add (name, clip); AnimationClip info = new AnimationClip (name, clip.ClipBones, clip.ModelExtra.Clips[0]); return info; }