public void ReloadAnimations() { Animations.Clear(); foreach (var file in Directory.GetFiles(KSPUtil.ApplicationRootPath + "GameData/", "*.anim", SearchOption.AllDirectories)) { KerbalAnimationClip clip = new KerbalAnimationClip(file, true); Animations.Add(clip); } if (Animations.Count <= 0) { ScreenMessages.PostScreenMessage("<color=red>No Animations found</color>"); return; } List <string> names = new List <string> (); foreach (var anim in Animations) { anim.Initialize(animation, transform); names.Add(anim.Name); } if (Fields ["SelectedAnimation"].uiControlFlight is UI_Cycle) { var cycle = Fields ["SelectedAnimation"].uiControlFlight as UI_Cycle; cycle.stateNames = names.ToArray(); AnimationNames = names.ToArray(); SelectedAnimation = 0; } animationsLoaded = true; }
void Awake() { castingClip = new KerbalAnimationClip("KerbalSports/anim/fishingCasting"); reelingClip = new KerbalAnimationClip("KerbalSports/anim/fishingReeling"); hookedClip = new KerbalAnimationClip("KerbalSports/anim/fishingHooked"); caughtClip = new KerbalAnimationClip("KerbalSports/anim/fishingCaught"); }
private void LoadAnimation(StringValue path) { Animation _kerbalanimation = null; shared.Vessel.GetComponentCached <Animation>(ref _kerbalanimation); var kerbaltransform = shared.Vessel.transform; KerbalAnimationClip myclip = new KerbalAnimationClip(); myclip.LoadFromURL(path.ToString()); myclip.Initialize(_kerbalanimation, kerbaltransform); }
//utility methods public void ReloadAnimations() { Clips = new List <KerbalAnimationClip> (); foreach (var path in Directory.GetFiles(KSPUtil.ApplicationRootPath + "GameData/", "*.anim", SearchOption.AllDirectories)) { KerbalAnimationClip clip = new KerbalAnimationClip(); clip.LoadFromPath(path); Clips.Add(clip); Debug.Log("KerbalAnimationClip " + clip.Name + " loaded from " + path); } int length = 10; if (Clips.Count < 10) { length = Clips.Count; } for (int i = 0; i < length; i++) { NumberKeyClips [i] = i; } AnimationPlayerWindowHost.Instance.OnReloadAnimationClips.Fire(Clips); }
public KerbalKeyframe(KerbalAnimationClip animClip) { this.clip = animClip; }
private void SetCurrentKeyframe(KerbalAnimationClip.KerbalKeyframe keyframe, bool saveOld = true) { //save old keyframe if (currentKeyframe != null && saveOld) { currentKeyframe.Write (Suite.Kerbal.transform, currentKeyframe.NormalizedTime); UpdateAnimationClip (); } //set new keyframe if (keyframe != null) { currentKeyframe = keyframe; animationClip.SetAnimationTime (keyframe.NormalizedTime); timeIndicatorTime = keyframe.NormalizedTime; } else { currentKeyframe = null; } }
public KerbalKeyframe(KerbalAnimationClip animClip) { this.clip = animClip; }
public void ReloadAnimations() { Animations.Clear (); foreach(var file in Directory.GetFiles(KSPUtil.ApplicationRootPath + "GameData/", "*.anim", SearchOption.AllDirectories)) { KerbalAnimationClip clip = new KerbalAnimationClip (file, true); Animations.Add (clip); } if (Animations.Count <= 0) { ScreenMessages.PostScreenMessage ("<color=red>No Animations found</color>"); return; } List<string> names = new List<string> (); foreach (var anim in Animations) { anim.Initialize (animation, transform); names.Add (anim.Name); } if (Fields ["SelectedAnimation"].uiControlFlight is UI_Cycle) { var cycle = Fields ["SelectedAnimation"].uiControlFlight as UI_Cycle; cycle.stateNames = names.ToArray (); AnimationNames = names.ToArray (); SelectedAnimation = 0; } animationsLoaded = true; }