/// <summary> /// Läd das SpineObject neu. /// </summary> public void LoadNewSpineObject(string pSkeletonName) { mPlaying = false; mEditorForm.listBoxFadingFrom.Items.Clear(); mEditorForm.listBoxFadingTo.Items.Clear(); mEditorForm.listBoxFadingFrom.ClearSelected(); mEditorForm.listBoxFadingTo.ClearSelected(); SpineDataManager.Instance.Unload(); SpineDataManager.Instance.LoadContent(); mSpine = new SpineObject(pSkeletonName); mSpine.LoadContent(); //Color Texture laden FileStream fileStream = new FileStream(EngineSettings.DefaultPathSpine + "\\" + pSkeletonName + ".png", FileMode.Open, FileAccess.Read); mSpine.Textures[0] = Texture2D.FromStream(EngineSettings.Graphics.GraphicsDevice, fileStream); List <string> TmpFadingListOutputFrom = new List <string>(); foreach (SpineData.AnimationMix animMix in SpineDataManager.Instance.GetElementByString(pSkeletonName).settings.AnimationFading) { if (!TmpFadingListOutputFrom.Contains(animMix.From.ToString())) { TmpFadingListOutputFrom.Add(animMix.From.ToString()); } } mEditorForm.listBoxFadingFrom.Items.AddRange(TmpFadingListOutputFrom.ToArray()); mEditorForm.numericUpDownScaling.Value = (decimal)SpineDataManager.Instance.GetElementByString(pSkeletonName).settings.Scaling; if (!mEditorForm.checkBoxLockView.Checked) { ResetView(); } ApplyView(); }
//Richtige Animation und richtigen FlipState anwenden public static void AnimateAccordingToDirection(SpineObject pSpine, Vector2 pDirection, string pAnimUp, string pAnimDown, string pAnimSide) { string anim = Character.GetRightDirectionAnimation(pDirection, pAnimUp, pAnimDown, pAnimSide); Character.SetSkeletonFlipState(pSpine, pDirection); Sequences.StartAnimation(pSpine, anim); }
public override void Initialize() { base.Initialize(); mInput = InputHelper.Player2; mCollisionBox.Width = 40; mCollisionBox.Height = 90; mModel = new SpineObject("sweetcheeks"); mAbilities.Remove(Activity.JumpOverGap); }
public override void Initialize() { base.Initialize(); mInput = InputHelper.Player1; mCollisionBox.Width = 50; mCollisionBox.Height = 100; mModel = new SpineObject("ashbrett"); mAbilities.Remove(Activity.Crawl); mAbilities.Remove(Activity.SlipThroughRock); mAbilities.Remove(Activity.UseChalk); }
//Animation Stepping public static void UpdateAnimationStepping(SpineObject pSpine, float pProgress) { if (pProgress > 0.9f) { pProgress = 0.9f; } if (pSpine.AnimationState.ToString() == "<none>") { return; } //if (pSpine.AnimationState.ToString() == "<none>") throw new Exception("SpineObjekt hat keinen AnimationState. TmpFix = return."); pSpine.AnimationState.GetCurrent(0).Time = pSpine.AnimationState.GetCurrent(0).EndTime *pProgress; }
public override void Update() { HandleInput(); if (mSpine != null && mPlaying) { mSpine.Update(); } if (mEditorForm.listBoxSkeletons.SelectedItem == null) { mSpine = null; } }
public static void SetSkeletonFlipState(SpineObject pSpineObj, Vector2 pAnimDirection) { pAnimDirection.Normalize(); if (pAnimDirection.X > 0) { pSpineObj.Flip = true; } else if (pAnimDirection.X < 0) { pSpineObj.Flip = false; } if (pSpineObj.AnimationState.GetCurrent(0) != null && (pAnimDirection.X == 0 && (pSpineObj.AnimationState.GetCurrent(0).animation.name.Contains("Down") || pSpineObj.AnimationState.GetCurrent(0).animation.name.Contains("Up")))) { pSpineObj.Flip = false; } }
//Player während Animation bewegen public static void SynchMovementToAnimation(SpineObject pSpineToSynchTo, Player pPlayer, Vector2 pSource, Vector2 pDestination) { float Progress = pSpineToSynchTo.AnimationState.GetCurrent(0).Time / pSpineToSynchTo.AnimationState.GetCurrent(0).EndTime; SetToPosition(pPlayer, pSource + (pDestination - pSource) * Progress); }
//Start Animation public static void StartAnimation(SpineObject pSpine, string pAnimation, bool pLoop = false) { pSpine.SetAnimation(pAnimation, pLoop, true); }
public void SetHero(GraphicsDevice graphicDevice, float baseScale) { Hero = new SpineObject(graphicDevice, "Sample", baseScale, Position); Hero.State.SetAnimation(0, "стоять ", true); }
public static bool AnimationComplete(SpineObject pSpine) { return(pSpine.AnimationComplete); }