當前位置: 首頁>>代碼示例>>C#>>正文


C# Skeleton.SetSlotAttachmentToSetupPose方法代碼示例

本文整理匯總了C#中Spine.Skeleton.SetSlotAttachmentToSetupPose方法的典型用法代碼示例。如果您正苦於以下問題:C# Skeleton.SetSlotAttachmentToSetupPose方法的具體用法?C# Skeleton.SetSlotAttachmentToSetupPose怎麽用?C# Skeleton.SetSlotAttachmentToSetupPose使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Spine.Skeleton的用法示例。


在下文中一共展示了Skeleton.SetSlotAttachmentToSetupPose方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: SetToSetupPose

		public static void SetToSetupPose (this Timeline timeline, Skeleton skeleton) {
			if (timeline != null) {
				// sorted according to assumed likelihood here

				// Bone
				if (timeline is RotateTimeline) {
					var bone = skeleton.bones.Items[((RotateTimeline)timeline).boneIndex];
					bone.rotation = bone.data.rotation;
				} else if (timeline is TranslateTimeline) {
					var bone = skeleton.bones.Items[((TranslateTimeline)timeline).boneIndex];
					bone.x = bone.data.x;
					bone.y = bone.data.y;
				} else if (timeline is ScaleTimeline) {
					var bone = skeleton.bones.Items[((ScaleTimeline)timeline).boneIndex];
					bone.scaleX = bone.data.scaleX;
					bone.scaleY = bone.data.scaleY;


				// Attachment
				} else if (timeline is DeformTimeline) {
					var slot = skeleton.slots.Items[((DeformTimeline)timeline).slotIndex];
					slot.attachmentVertices.Clear(false);

				// Slot
				} else if (timeline is AttachmentTimeline) {
					skeleton.SetSlotAttachmentToSetupPose(((AttachmentTimeline)timeline).slotIndex);

				} else if (timeline is ColorTimeline) {
					skeleton.slots.Items[((ColorTimeline)timeline).slotIndex].SetColorToSetupPose();


				// Constraint
				} else if (timeline is IkConstraintTimeline) {
					var ikTimeline = (IkConstraintTimeline)timeline;
					var ik = skeleton.ikConstraints.Items[ikTimeline.ikConstraintIndex];
					var data = ik.data;
					ik.bendDirection = data.bendDirection;
					ik.mix = data.mix;

				// Skeleton
				} else if (timeline is DrawOrderTimeline) {
					skeleton.SetDrawOrderToSetupPose();

				}

			}

		}
開發者ID:Hinidu,項目名稱:spine-runtimes,代碼行數:48,代碼來源:SkeletonExtensions.cs

示例2: SetToSetupPose

		// For each timeline type.
		// Timelines know how to apply themselves based on skeleton data; They should know how to reset the skeleton back to skeleton data?
		public static void SetToSetupPose (this Timeline timeline, Skeleton skeleton) {
			if (timeline != null) {
				// sorted according to assumed likelihood here

				// Bone stuff
				if (timeline is RotateTimeline) {
					var bone = skeleton.bones.Items[((RotateTimeline)timeline).boneIndex];
					bone.rotation = bone.data.rotation;
				} else if (timeline is TranslateTimeline) {
					var bone = skeleton.bones.Items[((TranslateTimeline)timeline).boneIndex];
					bone.x = bone.data.x;
					bone.y = bone.data.y;
				} else if (timeline is ScaleTimeline) {
					var bone = skeleton.bones.Items[((ScaleTimeline)timeline).boneIndex];
					bone.scaleX = bone.data.scaleX;
					bone.scaleY = bone.data.scaleY;


				// Attachment stuff. How do you reset FFD?
				} else if (timeline is FFDTimeline) {
					var slot = skeleton.slots.Items[((FFDTimeline)timeline).slotIndex];
					slot.attachmentVerticesCount = 0;	// This causes (Weighted)MeshAttachment.ComputeWorldVertices to use its internal(stateless) vertex array.
					//slot.attachmentTime = bone.skeleton.time; // Currently inconsequential. (Spine 3.1)
				
				// Slot stuff. This is heavy to do every frame. Maybe not do it?
				} else if (timeline is AttachmentTimeline) {
					skeleton.SetSlotAttachmentToSetupPose(((AttachmentTimeline)timeline).slotIndex);

				} else if (timeline is ColorTimeline) {
					skeleton.slots.Items[((ColorTimeline)timeline).slotIndex].SetColorToSetupPose();


				// Constraint Stuff
				} else if (timeline is IkConstraintTimeline) {
					var ikTimeline = (IkConstraintTimeline)timeline;
					var ik = skeleton.ikConstraints.Items[ikTimeline.ikConstraintIndex];
					var data = ik.data;
					ik.bendDirection = data.bendDirection;
					ik.mix = data.mix;

				// Skeleton stuff. Skeleton.SetDrawOrderToSetupPose. This is heavy to do every frame. Maybe not do it?
				} else if (timeline is DrawOrderTimeline) {
					skeleton.SetDrawOrderToSetupPose();


				}

			}


		}
開發者ID:SirFelolis,項目名稱:Snot-Ninja,代碼行數:53,代碼來源:SkeletonExtensions.cs


注:本文中的Spine.Skeleton.SetSlotAttachmentToSetupPose方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。