当前位置: 首页>>代码示例>>C#>>正文


C# Spine.Skeleton类代码示例

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


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


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