• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Spine.Skeleton类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Spine.Skeleton的典型用法代码示例。如果您正苦于以下问题:C# Skeleton类的具体用法?C# Skeleton怎么用?C# Skeleton使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Skeleton类属于Spine命名空间,在下文中一共展示了Skeleton类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: AnimationPlayer

 public AnimationPlayer(SkeletonData skeletonData)
 {
     this.skeletonData = skeletonData;
     skeleton = new Skeleton(skeletonData);
     skeleton.SetSlotsToSetupPose();
     animationDataPool = new ObjectPool<AnimationData>(() => new AnimationData(), 10);
 }
开发者ID:ThirdPartyNinjas,项目名称:NinjaSharp,代码行数:7,代码来源:AnimationPlayer.cs


示例2: Update

		public void Update (Skeleton skeleton, bool updateAabb) {
			ExposedList<BoundingBoxAttachment> boundingBoxes = BoundingBoxes;
			ExposedList<Polygon> polygons = Polygons;
			ExposedList<Slot> slots = skeleton.slots;
			int slotCount = slots.Count;

			boundingBoxes.Clear();
			for (int i = 0, n = polygons.Count; i < n; i++)
				polygonPool.Add(polygons.Items[i]);
			polygons.Clear();

			for (int i = 0; i < slotCount; i++) {
				Slot slot = slots.Items[i];
				BoundingBoxAttachment boundingBox = slot.attachment as BoundingBoxAttachment;
				if (boundingBox == null) continue;
				boundingBoxes.Add(boundingBox);

				Polygon polygon = null;
				int poolCount = polygonPool.Count;
				if (poolCount > 0) {
					polygon = polygonPool.Items[poolCount - 1];
					polygonPool.RemoveAt(poolCount - 1);
				} else
					polygon = new Polygon();
				polygons.Add(polygon);

				int count = boundingBox.Vertices.Length;
				polygon.Count = count;
				if (polygon.Vertices.Length < count) polygon.Vertices = new float[count];
				boundingBox.ComputeWorldVertices(slot, polygon.Vertices);
			}

			if (updateAabb) aabbCompute();
		}
开发者ID:X-Ray-Jin,项目名称:spine-runtimes,代码行数:34,代码来源:SkeletonBounds.cs


示例3: Animation

        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;
        }
开发者ID:CloneDeath,项目名称:PokemonSmash,代码行数:25,代码来源:Animation.cs


示例4: Start

	void Start () {
		// Make sure you get these AnimationState and Skeleton references in Start or Later. Getting and using them in Awake is not guaranteed by default execution order.
		skeletonAnimation = GetComponent<SkeletonAnimation>();
		spineAnimationState = skeletonAnimation.state;
		skeleton = skeletonAnimation.skeleton;

		StartCoroutine(DoDemoRoutine());
	}
开发者ID:X-Ray-Jin,项目名称:spine-runtimes,代码行数:8,代码来源:SpineBeginnerTwo.cs


示例5: Bone

		/// <param name="parent">May be null.</param>
		public Bone (BoneData data, Skeleton skeleton, Bone parent) {
			if (data == null) throw new ArgumentNullException("data", "data cannot be null.");
			if (skeleton == null) throw new ArgumentNullException("skeleton", "skeleton cannot be null.");
			this.data = data;
			this.skeleton = skeleton;
			this.parent = parent;
			SetToSetupPose();
		}
开发者ID:EsotericSoftware,项目名称:spine-runtimes,代码行数:9,代码来源:Bone.cs


示例6: Entity

 public Entity(Skeleton skeleton, Vector2 position)
     : this(position)
 {
     Skeleton = skeleton;
     skeletonBoundingBox = ResourceManager.GetSkeletonBoundingBox(skeleton.Data.Name);
     AnimationState = new AnimationState(new AnimationStateData(skeleton.Data));
     RenderShadow = true;
 }
开发者ID:supermaximo93,项目名称:SuperFantasticSteampunk,代码行数:8,代码来源:Entity.cs


示例7: SkeletonSpatial

        public SkeletonSpatial(GraphicsDevice device, string contentPath, string skin)
        {
            if (!_registered.TryGetValue(contentPath, out _record))
                _record = Load(device, contentPath);

            _skeleton = new Skeleton(_record.Data);
            _skeleton.SetSkin(skin);
            _skeleton.SetSlotsToBindPose();
        }
开发者ID:jaquadro,项目名称:Amphibian,代码行数:9,代码来源:SkeletonSpatial.cs


示例8: Draw

		public void Draw (Skeleton skeleton) {
			var drawOrder = skeleton.DrawOrder;
			var drawOrderItems = skeleton.DrawOrder.Items;
			float skeletonR = skeleton.R, skeletonG = skeleton.G, skeletonB = skeleton.B, skeletonA = skeleton.A;
			for (int i = 0, n = drawOrder.Count; i < n; i++) {
				Slot slot = drawOrderItems[i];
				RegionAttachment regionAttachment = slot.Attachment as RegionAttachment;
				if (regionAttachment != null) {
					BlendState blend = slot.Data.BlendMode == BlendMode.additive ? BlendState.Additive : defaultBlendState;
					if (device.BlendState != blend) {
						End();
						device.BlendState = blend;
					}

					RegionItem item = batcher.NextItem();

					AtlasRegion region = (AtlasRegion)regionAttachment.RendererObject;
					item.texture = (Texture2D)region.page.rendererObject;

					Color color;
					float a = skeletonA * slot.A;
					if (premultipliedAlpha)
						color = new Color(skeletonR * slot.R * a, skeletonG * slot.G * a, skeletonB * slot.B * a, a);
					else
						color = new Color(skeletonR * slot.R, skeletonG * slot.G, skeletonB * slot.B, a);
					item.vertexTL.Color = color;
					item.vertexBL.Color = color;
					item.vertexBR.Color = color;
					item.vertexTR.Color = color;

					float[] vertices = this.vertices;
					regionAttachment.ComputeWorldVertices(slot.Bone, vertices);
					item.vertexTL.Position.X = vertices[RegionAttachment.X1];
					item.vertexTL.Position.Y = vertices[RegionAttachment.Y1];
					item.vertexTL.Position.Z = 0;
					item.vertexBL.Position.X = vertices[RegionAttachment.X2];
					item.vertexBL.Position.Y = vertices[RegionAttachment.Y2];
					item.vertexBL.Position.Z = 0;
					item.vertexBR.Position.X = vertices[RegionAttachment.X3];
					item.vertexBR.Position.Y = vertices[RegionAttachment.Y3];
					item.vertexBR.Position.Z = 0;
					item.vertexTR.Position.X = vertices[RegionAttachment.X4];
					item.vertexTR.Position.Y = vertices[RegionAttachment.Y4];
					item.vertexTR.Position.Z = 0;

					float[] uvs = regionAttachment.UVs;
					item.vertexTL.TextureCoordinate.X = uvs[RegionAttachment.X1];
					item.vertexTL.TextureCoordinate.Y = uvs[RegionAttachment.Y1];
					item.vertexBL.TextureCoordinate.X = uvs[RegionAttachment.X2];
					item.vertexBL.TextureCoordinate.Y = uvs[RegionAttachment.Y2];
					item.vertexBR.TextureCoordinate.X = uvs[RegionAttachment.X3];
					item.vertexBR.TextureCoordinate.Y = uvs[RegionAttachment.Y3];
					item.vertexTR.TextureCoordinate.X = uvs[RegionAttachment.X4];
					item.vertexTR.TextureCoordinate.Y = uvs[RegionAttachment.Y4];
				}
			}
		}
开发者ID:Kikkur,项目名称:spine-runtimes,代码行数:57,代码来源:SkeletonRegionRenderer.cs


示例9: Slot

		public Slot (SlotData data, Skeleton skeleton, Bone bone) {
			if (data == null) throw new ArgumentNullException("data cannot be null.");
			if (skeleton == null) throw new ArgumentNullException("skeleton cannot be null.");
			if (bone == null) throw new ArgumentNullException("bone cannot be null.");
			this.data = data;
			this.skeleton = skeleton;
			this.bone = bone;
			SetToSetupPose();
		}
开发者ID:D021,项目名称:ink,代码行数:9,代码来源:Slot.cs


示例10: Apply

        /** Poses the skeleton at the specified time for this animation. */
        public void Apply(Skeleton skeleton, float time, bool loop)
        {
            if (skeleton == null) throw new ArgumentNullException("skeleton cannot be null.");

            if (loop && Duration != 0) time %= Duration;

            List<Timeline> timelines = Timelines;
            for (int i = 0, n = timelines.Count; i < n; i++)
                timelines[i].Apply(skeleton, time, 1);
        }
开发者ID:jaquadro,项目名称:Amphibian,代码行数:11,代码来源:Animation.cs


示例11: DrawPackage

		public DrawPackage(Vector2 pPosition, float pPositionZ, Rectangle pCollisionBox, Color pDebugColor, Skeleton pSkeleton, float pAlpha = 1f)
		{
			mPosition = pPosition;
			mPositionZ = pPositionZ;
			mCollisionBox = pCollisionBox;
			mDebugColor = pDebugColor;
			mSkeleton = pSkeleton;
			mAlpha = pAlpha;
			Spine = true;
		}
开发者ID:KryptonDev,项目名称:KryptonEngine,代码行数:10,代码来源:DrawPackage.cs


示例12: IkConstraint

		public IkConstraint (IkConstraintData data, Skeleton skeleton) {
			this.data = data;
			mix = data.mix;
			bendDirection = data.bendDirection;

			bones = new List<Bone>(data.bones.Count);
			foreach (BoneData boneData in data.bones)
				bones.Add(skeleton.FindBone(boneData.name));
			target = skeleton.FindBone(data.target.name);
		}
开发者ID:ChemiKhazi,项目名称:spine-runtimes,代码行数:10,代码来源:IkConstraint.cs


示例13: TransformConstraint

		public TransformConstraint (TransformConstraintData data, Skeleton skeleton) {
			if (data == null) throw new ArgumentNullException("data cannot be null.");
			if (skeleton == null) throw new ArgumentNullException("skeleton cannot be null.");
			this.data = data;
			translateMix = data.translateMix;
			x = data.x;
			y = data.y;

			bone = skeleton.FindBone(data.bone.name);
			target = skeleton.FindBone(data.target.name);
		}
开发者ID:czlc,项目名称:spine-runtimes,代码行数:11,代码来源:TransformConstraint.cs


示例14: DrawSlots

		private void DrawSlots(Skeleton skeleton)
		{
			isNormalTriangleWindingOrder = skeleton.FlipX ^ skeleton.FlipY;
			List<Slot> drawOrder = skeleton.DrawOrder;
			foreach (Slot slot in drawOrder)
			{
				var attachment = slot.Attachment as RegionAttachment;
				if (attachment != null)
					DrawSlot(skeleton, attachment, slot);
			}
		}
开发者ID:whztt07,项目名称:DeltaEngine,代码行数:11,代码来源:SpineRenderer.cs


示例15: Draw

        public void Draw(Skeleton skeleton, Vector3 Position)
        {
            List<Slot> DrawOrder = skeleton.DrawOrder;

            float depth = Z;
            float depth_offset = 0.0001f;
            for (int i = 0; i < DrawOrder.Count; i++) {
                Slot slot = DrawOrder[i];
                RegionAttachment regionAttachment = slot.Attachment as RegionAttachment;
                if (regionAttachment != null) {
                    SpriteBatchItem item = new SpriteBatchItem();
                    AtlasRegion region = (AtlasRegion)regionAttachment.RendererObject;
                    item.Texture = (int)region.page.rendererObject;

                    byte r = (byte)(skeleton.R * slot.R * 255);
                    byte g = (byte)(skeleton.G * slot.G * 255);
                    byte b = (byte)(skeleton.B * slot.B * 255);
                    byte a = (byte)(skeleton.A * slot.A * 255);
                    item.vertexTL.Color = Color.FromArgb(a, r, g, b);
                    item.vertexBL.Color = Color.FromArgb(a, r, g, b);
                    item.vertexBR.Color = Color.FromArgb(a, r, g, b);
                    item.vertexTR.Color = Color.FromArgb(a, r, g, b);

                    float[] vertices = this.vertices;
                    regionAttachment.ComputeWorldVertices(skeleton.X, skeleton.Y, slot.Bone, vertices);
                    item.vertexTL.Position.X = vertices[RegionAttachment.X1];
                    item.vertexTL.Position.Y = vertices[RegionAttachment.Y1];
                    item.vertexTL.Position.Z = depth;
                    item.vertexBL.Position.X = vertices[RegionAttachment.X2];
                    item.vertexBL.Position.Y = vertices[RegionAttachment.Y2];
                    item.vertexBL.Position.Z = depth;
                    item.vertexBR.Position.X = vertices[RegionAttachment.X3];
                    item.vertexBR.Position.Y = vertices[RegionAttachment.Y3];
                    item.vertexBR.Position.Z = depth;
                    item.vertexTR.Position.X = vertices[RegionAttachment.X4];
                    item.vertexTR.Position.Y = vertices[RegionAttachment.Y4];
                    item.vertexTR.Position.Z = depth;

                    float[] uvs = regionAttachment.UVs;
                    item.vertexTL.TextureCoordinate.X = uvs[RegionAttachment.X1];
                    item.vertexTL.TextureCoordinate.Y = uvs[RegionAttachment.Y1];
                    item.vertexBL.TextureCoordinate.X = uvs[RegionAttachment.X2];
                    item.vertexBL.TextureCoordinate.Y = uvs[RegionAttachment.Y2];
                    item.vertexBR.TextureCoordinate.X = uvs[RegionAttachment.X3];
                    item.vertexBR.TextureCoordinate.Y = uvs[RegionAttachment.Y3];
                    item.vertexTR.TextureCoordinate.X = uvs[RegionAttachment.X4];
                    item.vertexTR.TextureCoordinate.Y = uvs[RegionAttachment.Y4];

                    this.DrawItem(item);
                    depth += depth_offset;
                }
            }
        }
开发者ID:CloneDeath,项目名称:spine-runtimes,代码行数:53,代码来源:SkeletonRenderer.cs


示例16: Apply

		/// <summary>Applies all the animation's timelines to the specified skeleton.</summary>
		/// <param name="skeleton">The skeleton to be posed.</param>
		/// <param name="lastTime">The last time the animation was applied.</param>
		/// <param name="time">The point in time in the animation to apply to the skeleton.</param>
		/// <param name="loop">If true, time wraps within the animation duration.</param>
		/// <param name="events">Any triggered events are added. May be null.</param>
		/// <param name="alpha">The percentage between this animation's pose and the current pose.</param>
		/// <param name="setupPose">If true, the animation is mixed with the setup pose, else it is mixed with the current pose. Passing true when alpha is 1 is slightly more efficient.</param>
		/// <param name="mixingOut">True when mixing over time toward the setup or current pose, false when mixing toward the keyed pose. Irrelevant when alpha is 1.</param>
		/// <seealso cref="Timeline.Apply(Skeleton, float, float, ExposedList, float, bool, bool)"/>
		public void Apply (Skeleton skeleton, float lastTime, float time, bool loop, ExposedList<Event> events, float alpha, bool setupPose, bool mixingOut) {
			if (skeleton == null) throw new ArgumentNullException("skeleton", "skeleton cannot be null.");

			if (loop && duration != 0) {
				time %= duration;
				if (lastTime > 0) lastTime %= duration;
			}

			ExposedList<Timeline> timelines = this.timelines;
			for (int i = 0, n = timelines.Count; i < n; i++)
				timelines.Items[i].Apply(skeleton, lastTime, time, events, alpha, setupPose, mixingOut);
		}
开发者ID:EsotericSoftware,项目名称:spine-runtimes,代码行数:22,代码来源:Animation.cs


示例17: Mix

		/// <summary>Poses the skeleton at the specified time for this animation mixed with the current pose.</summary>
		/// <param name="lastTime">The last time the animation was applied.</param>
		/// <param name="events">Any triggered events are added.</param>
		/// <param name="alpha">The amount of this animation that affects the current pose.</param>
		public void Mix (Skeleton skeleton, float lastTime, float time, bool loop, List<Event> events, float alpha) {
			if (skeleton == null) throw new ArgumentNullException("skeleton cannot be null.");

			if (loop && duration != 0) {
				time %= duration;
				lastTime %= duration;
			}

			List<Timeline> timelines = this.timelines;
			for (int i = 0, n = timelines.Count; i < n; i++)
				timelines[i].Apply(skeleton, lastTime, time, events, alpha);
		}
开发者ID:D021,项目名称:ink,代码行数:16,代码来源:Animation.cs


示例18: IkConstraint

		public IkConstraint (IkConstraintData data, Skeleton skeleton) {
			if (data == null) throw new ArgumentNullException("data cannot be null.");
			if (skeleton == null) throw new ArgumentNullException("skeleton cannot be null.");
			this.data = data;
			mix = data.mix;
			bendDirection = data.bendDirection;

			bones = new ExposedList<Bone>(data.bones.Count);
			foreach (BoneData boneData in data.bones)
				bones.Add(skeleton.FindBone(boneData.name));
			target = skeleton.FindBone(data.target.name);
		}
开发者ID:ClazzX1,项目名称:BussStopOCD,代码行数:12,代码来源:IkConstraint.cs


示例19: PathConstraint

		public PathConstraint (PathConstraintData data, Skeleton skeleton) {
			if (data == null) throw new ArgumentNullException("data", "data cannot be null.");
			if (skeleton == null) throw new ArgumentNullException("skeleton", "skeleton cannot be null.");
			this.data = data;
			bones = new ExposedList<Bone>(data.Bones.Count);
			foreach (BoneData boneData in data.bones)
				bones.Add(skeleton.FindBone(boneData.name));
			target = skeleton.FindSlot(data.target.name);
			position = data.position;
			spacing = data.spacing;
			rotateMix = data.rotateMix;
			translateMix = data.translateMix;
		}
开发者ID:Colorwen,项目名称:spine-runtimes,代码行数:13,代码来源:PathConstraint.cs


示例20: DrawSlot

		private void DrawSlot(Skeleton skeleton, RegionAttachment attachment, Slot slot)
		{
			var region = (AtlasRegion)attachment.RendererObject;
			var thisMaterial = (Material)region.page.rendererObject;
			var thisBlendMode = slot.Data.AdditiveBlending ? BlendMode.Additive : BlendMode.Normal;
			var thisBatch = (Batch2D)renderer.FindOrCreateBatch(thisMaterial, thisBlendMode);
			if (currentBatch != null && currentBatch != thisBatch)
				renderer.FlushDrawBuffer(currentBatch);
			currentBatch = thisBatch;
			attachment.ComputeWorldVertices(skeleton.X, skeleton.Y, slot.Bone, vertices);
			currentColor = new Color(color.RedValue * slot.R, color.GreenValue * slot.G,
				color.BlueValue * slot.B, color.AlphaValue * slot.A);
			AddSlotIndicesAndVertices(attachment.UVs);
		}
开发者ID:whztt07,项目名称:DeltaEngine,代码行数:14,代码来源:SpineRenderer.cs



注:本文中的Spine.Skeleton类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Spine.SkeletonData类代码示例发布时间:2022-05-26
下一篇:
C# Spine.Bone类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap