public Animation(string AnimationFile) { skeletonRenderer = new SkeletonRenderer(); String name = AnimationFile; Atlas atlas = new Atlas("Data/" + name + ".atlas", new GLImpTextureLoader()); SkeletonJson json = new SkeletonJson(atlas); skeleton = new Skeleton(json.ReadSkeletonData("Data/" + name + ".json")); skeleton.SetSlotsToSetupPose(); // Define mixing between animations. stateData = new AnimationStateData(skeleton.Data); state = new AnimationState(stateData); //state.SetAnimation("idle", true); skeleton.X = 0; skeleton.Y = 0.1f; skeleton.UpdateWorldTransform(); drawtime = new Stopwatch(); drawtime.Start(); Program.MiddleDrawQueue += Draw; }
protected override void LoadContent() { skeletonRenderer = new SkeletonRenderer(GraphicsDevice); String name = "spineboy"; // "goblins"; Atlas atlas = new Atlas("data/" + name + ".atlas", new XnaTextureLoader(GraphicsDevice)); SkeletonJson json = new SkeletonJson(atlas); skeleton = new Skeleton(json.ReadSkeletonData("data/" + name + ".json")); if (name == "goblins") { skeleton.SetSkin("goblingirl"); } skeleton.SetSlotsToSetupPose(); // Without this the skin attachments won't be attached. See SetSkin. // Define mixing between animations. AnimationStateData stateData = new AnimationStateData(skeleton.Data); if (name == "spineboy") { stateData.SetMix("walk", "jump", 0.2f); stateData.SetMix("jump", "walk", 0.4f); } state = new AnimationState(stateData); state.SetAnimation("walk", false); state.AddAnimation("jump", false); state.AddAnimation("walk", true); skeleton.RootBone.X = 320; skeleton.RootBone.Y = 440; skeleton.UpdateWorldTransform(); }
public AnimationPlayer(SkeletonData skeletonData) { this.skeletonData = skeletonData; skeleton = new Skeleton(skeletonData); skeleton.SetSlotsToSetupPose(); animationDataPool = new ObjectPool<AnimationData>(() => new AnimationData(), 10); }
protected override void LoadContent() { skeletonRenderer = new SkeletonRenderer(GraphicsDevice); skeletonRenderer.PremultipliedAlpha = true; String name = "spineboy"; // "goblins"; Atlas atlas = new Atlas("data/" + name + ".atlas", new XnaTextureLoader(GraphicsDevice)); SkeletonJson json = new SkeletonJson(atlas); skeleton = new Skeleton(json.ReadSkeletonData("data/" + name + ".json")); if (name == "goblins") { skeleton.SetSkin("goblingirl"); } skeleton.SetSlotsToSetupPose(); // Without this the skin attachments won't be attached. See SetSkin. // Define mixing between animations. AnimationStateData stateData = new AnimationStateData(skeleton.Data); if (name == "spineboy") { stateData.SetMix("walk", "jump", 0.2f); stateData.SetMix("jump", "walk", 0.4f); } state = new AnimationState(stateData); if (true) { // Event handling for all animations. state.Start += Start; state.End += End; state.Complete += Complete; state.Event += Event; state.SetAnimation(0, "drawOrder", true); } else { state.SetAnimation(0, "walk", false); TrackEntry entry = state.AddAnimation(0, "jump", false, 0); entry.End += End; // Event handling for queued animations. state.AddAnimation(0, "walk", true, 0); } skeleton.X = 320; skeleton.Y = 440; skeleton.UpdateWorldTransform(); headSlot = skeleton.FindSlot("head"); }
public virtual void Initialize() { mesh = new Mesh(); GetComponent<MeshFilter>().mesh = mesh; mesh.name = "Skeleton Mesh"; mesh.hideFlags = HideFlags.HideAndDontSave; skeleton = new Skeleton(skeletonDataAsset.GetSkeletonData(false)); if (initialSkinName != null && initialSkinName.Length > 0) { skeleton.SetSkin(initialSkinName); skeleton.SetSlotsToSetupPose(); } }
static int SetSlotsToSetupPose(IntPtr L) { try { ToLua.CheckArgsCount(L, 1); Spine.Skeleton obj = (Spine.Skeleton)ToLua.CheckObject <Spine.Skeleton>(L, 1); obj.SetSlotsToSetupPose(); return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
public SpinePlayer(string atlasPath, string jsonPath) { Name = jsonPath; _skeletonRenderer = new SkeletonRenderer(Render.Device); var atlas = new Atlas(atlasPath, new XnaTextureLoader(Render.Device)); var json = new SkeletonJson(atlas); Skeleton = new Skeleton(json.ReadSkeletonData(jsonPath)); Skeleton.SetSlotsToSetupPose(); // Without this the skin attachments won't be attached. See SetSkin. var stateData = new AnimationStateData(Skeleton.Data); State = new AnimationState(stateData); IsVisible = true; }
protected override void LoadContent() { Effect spriteBatchEffect = Content.Load<Effect>("SpriteBatchEffect"); spriteBatch = new SpriteBatchEx(GraphicsDevice, spriteBatchEffect); Bone.yDown = true; skeletonData = Content.Load<SkeletonData>("spineboy/spineboy"); skeleton = new Skeleton(skeletonData); skeleton.SetSlotsToSetupPose(); AnimationStateData stateData = new AnimationStateData(skeleton.Data); animationState = new AnimationState(stateData); animationState.SetAnimation(0, "walk", true); skeleton.UpdateWorldTransform(); }
public virtual void Initialize() { mesh = new Mesh(); GetComponent<MeshFilter>().mesh = mesh; mesh.name = "Skeleton Mesh"; mesh.hideFlags = HideFlags.HideAndDontSave; mesh.MarkDynamic(); renderer.sharedMaterial = skeletonDataAsset.atlasAsset.material; vertices = new Vector3[0]; skeleton = new Skeleton(skeletonDataAsset.GetSkeletonData(false)); if (initialSkinName != null && initialSkinName.Length > 0) { skeleton.SetSkin(initialSkinName); skeleton.SetSlotsToSetupPose(); } }
public Avatar(string AnimationFile) { SkeletonRenderer = new SkeletonRenderer(Vector3.UnitY, Vector3.UnitZ); String name = AnimationFile; Atlas atlas = new Atlas(name + ".atlas", new OpenTKTextureLoader()); SkeletonJson json = new SkeletonJson(atlas); Skeleton = new Skeleton(json.ReadSkeletonData(name + ".json")); Skeleton.SetSlotsToSetupPose(); // Define mixing between animations. StateData = new AnimationStateData(Skeleton.Data); State = new AnimationState(StateData); Skeleton.X = 0; Skeleton.Y = 0; Skeleton.UpdateWorldTransform(); }
protected override void LoadContent() { skeletonRenderer = new SkeletonRenderer(GraphicsDevice); String name = "spineboy"; // "goblins"; Atlas atlas = new Atlas("data/" + name + ".atlas", new XnaTextureLoader(GraphicsDevice)); SkeletonJson json = new SkeletonJson(atlas); skeleton = new Skeleton(json.ReadSkeletonData("data/" + name + ".json")); if (name == "goblins") skeleton.SetSkin("goblingirl"); skeleton.SetSlotsToSetupPose(); // Without this the skin attachments won't be attached. See SetSkin. // Define mixing between animations. AnimationStateData stateData = new AnimationStateData(skeleton.Data); if (name == "spineboy") { stateData.SetMix("walk", "jump", 0.2f); stateData.SetMix("jump", "walk", 0.4f); } state = new AnimationState(stateData); if (true) { // Event handling for all animations. state.Start += new EventHandler(Start); state.End += new EventHandler(End); state.Complete += new EventHandler<CompleteArgs>(Complete); state.Event += new EventHandler<EventTriggeredArgs>(Event); state.SetAnimation("drawOrder", true); } else { state.SetAnimation("walk", false); QueueEntry entry = state.AddAnimation("jump", false); entry.End += new EventHandler(End); // Event handling for queued animations. state.AddAnimation("walk", true); } skeleton.X = 320; skeleton.Y = 440; skeleton.UpdateWorldTransform(); headSlot = skeleton.FindSlot("head"); }
public virtual void Initialize() { if (Initialized) return; meshFilter = GetComponent<MeshFilter>(); mesh1 = newMesh(); mesh2 = newMesh(); vertices = new Vector3[0]; skeleton = new Skeleton(skeletonDataAsset.GetSkeletonData(false)); if (initialSkinName != null && initialSkinName.Length > 0 && initialSkinName != "default") { skeleton.SetSkin(initialSkinName); skeleton.SetSlotsToSetupPose(); } }
public void Load() { mSkeletonRenderer = new SkeletonRenderer(EngineSettings.Graphics.GraphicsDevice); mBounds = new SkeletonBounds(); mSkeleton = SpineDataManager.Instance.NewSkeleton(mName, mScale); //Fixed Scale from here. Main instanciation. mSkeleton.SetSlotsToSetupPose(); // Without this the skin attachments won't be attached. See SetSkin. mAnimationState = SpineDataManager.Instance.NewAnimationState(mSkeleton.Data); mSkeleton.X = mInitPosition.X; mSkeleton.Y = mInitPosition.Y; }
protected override void LoadContent() { skeletonRenderer = new SkeletonRenderer(GraphicsDevice); String name = "spineboy"; // "goblins"; Atlas atlas = new Atlas("data/" + name + ".atlas", new XnaTextureLoader(GraphicsDevice)); SkeletonJson json = new SkeletonJson(atlas); skeleton = new Skeleton(json.ReadSkeletonData("data/" + name + ".json")); if (name == "goblins") skeleton.SetSkin("goblingirl"); skeleton.SetSlotsToSetupPose(); // Without this the skin attachments won't be attached. See SetSkin. // Define mixing between animations. AnimationStateData stateData = new AnimationStateData(skeleton.Data); if (name == "spineboy") { stateData.SetMix("walk", "jump", 0.2f); stateData.SetMix("jump", "walk", 0.4f); } state = new AnimationState(stateData); state.SetAnimation("walk", false); state.AddAnimation("jump", false); state.AddAnimation("walk", true); skeleton.RootBone.X = 320; skeleton.RootBone.Y = 440; skeleton.UpdateWorldTransform(); }