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

C# Spine.Bone类代码示例

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

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



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

示例1: Bone

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


示例2: Slot

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


示例3: Skeleton

		public Skeleton (SkeletonData data) {
			if (data == null) throw new ArgumentNullException("data cannot be null.");
			this.data = data;

			bones = new ExposedList<Bone>(data.bones.Count);
			foreach (BoneData boneData in data.bones) {
				Bone parent = boneData.parent == null ? null : bones.Items[data.bones.IndexOf(boneData.parent)];
				Bone bone = new Bone(boneData, this, parent);
				if (parent != null) parent.children.Add(bone);
				bones.Add(bone);
			}

			slots = new ExposedList<Slot>(data.slots.Count);
			drawOrder = new ExposedList<Slot>(data.slots.Count);
			foreach (SlotData slotData in data.slots) {
				Bone bone = bones.Items[data.bones.IndexOf(slotData.boneData)];
				Slot slot = new Slot(slotData, bone);
				slots.Add(slot);
				drawOrder.Add(slot);
			}

			ikConstraints = new ExposedList<IkConstraint>(data.ikConstraints.Count);
			foreach (IkConstraintData ikConstraintData in data.ikConstraints)
				ikConstraints.Add(new IkConstraint(ikConstraintData, this));

			transformConstraints = new ExposedList<TransformConstraint>(data.transformConstraints.Count);
			foreach (TransformConstraintData transformConstraintData in data.transformConstraints)
				transformConstraints.Add(new TransformConstraint(transformConstraintData, this));

			UpdateCache();
			UpdateWorldTransform();
		}
开发者ID:czlc,项目名称:spine-runtimes,代码行数:32,代码来源:Skeleton.cs


示例4: Bone

 /** @param parent May be null. */
 public Bone(BoneData data, Bone parent)
 {
     if (data == null) throw new ArgumentNullException("data cannot be null.");
     Data = data;
     Parent = parent;
     SetToBindPose();
 }
开发者ID:nagyistoce,项目名称:RoboFight,代码行数:8,代码来源:Bone.cs


示例5: apply

		/// <summary>Adjusts the bone rotation so the tip is as close to the target position as possible. The target is specified
		/// in the world coordinate system.</summary>
		static public void apply (Bone bone, float targetX, float targetY, float alpha) {
			float parentRotation = (!bone.data.inheritRotation || bone.parent == null) ? 0 : bone.parent.worldRotation;
			float rotation = bone.rotation;
			float rotationIK = (float)Math.Atan2(targetY - bone.worldY, targetX - bone.worldX) * radDeg;
			if (bone.worldFlipX != (bone.worldFlipY != Bone.yDown)) rotationIK = -rotationIK;
			rotationIK -= parentRotation;
			bone.rotationIK = rotation + (rotationIK - rotation) * alpha;
		}
开发者ID:ClazzX1,项目名称:BussStopOCD,代码行数:10,代码来源:IkConstraint.cs


示例6: 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


示例7: Start

	void Start() {
		if (speedReference == null)
			speedReference = transform;

		skeletonAnimation = GetComponent<SkeletonAnimation>();
		bone = SpineBone.GetBone(boneName, skeletonAnimation);
		skeletonAnimation.UpdateLocal += UpdateLocal;
		lastPosition = speedReference.position;
	}
开发者ID:Lucius0,项目名称:spine-runtimes,代码行数:9,代码来源:DynamicSpineBone.cs


示例8: Apply

		/// <summary>Adjusts the bone rotation so the tip is as close to the target position as possible. The target is specified
		/// in the world coordinate system.</summary>
		static public void Apply (Bone bone, float targetX, float targetY, float alpha) {
			float parentRotation = bone.parent == null ? 0 : bone.parent.WorldRotationX;
			float rotation = bone.rotation;
			float rotationIK = MathUtils.Atan2(targetY - bone.worldY, targetX - bone.worldX) * MathUtils.radDeg - parentRotation;
			if (bone.worldSignX != bone.worldSignY) rotationIK = 360 - rotationIK;
			if (rotationIK > 180) rotationIK -= 360;
			else if (rotationIK < -180) rotationIK += 360;
			bone.UpdateWorldTransform(bone.x, bone.y, rotation + (rotationIK - rotation) * alpha, bone.scaleX, bone.scaleY);
		}
开发者ID:Chanisco,项目名称:BeatThemUp,代码行数:11,代码来源:IkConstraint.cs


示例9: 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


示例10: 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.");
     Data = data;
     Skeleton = skeleton;
     Bone = bone;
     SetToSetupPose();
 }
开发者ID:kamaliang,项目名称:spine-runtimes,代码行数:10,代码来源:Slot.cs


示例11: 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


示例12: 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


示例13: Apply

		/// <summary>Adjusts the bone rotation so the tip is as close to the target position as possible. The target is specified
		/// in the world coordinate system.</summary>
		static public void Apply (Bone bone, float targetX, float targetY, float alpha) {
			Bone pp = bone.parent;
			float id = 1 / (pp.a * pp.d - pp.b * pp.c);
			float x = targetX - pp.worldX, y = targetY - pp.worldY;
			float tx = (x * pp.d - y * pp.b) * id - bone.x, ty = (y * pp.a - x * pp.c) * id - bone.y;
			float rotationIK = MathUtils.Atan2(ty, tx) * MathUtils.radDeg - bone.shearX - bone.rotation;
			if (bone.scaleX < 0) rotationIK += 180;
			if (rotationIK > 180)
				rotationIK -= 360;
			else if (rotationIK < -180) rotationIK += 360;
			bone.UpdateWorldTransform(bone.x, bone.y, bone.rotation + rotationIK * alpha, bone.scaleX, bone.scaleY,
				bone.shearX, bone.shearY);
		}
开发者ID:Colorwen,项目名称:spine-runtimes,代码行数:15,代码来源:IkConstraint.cs


示例14: Start

 void Start()
 {
     clock = GetComponent<SkeletonAnimation>();
     clockState = clock.state;
     clockState.TimeScale = 1.0f;
     clockState.SetAnimation(0, "loop", true);
     armLong = clock.skeleton.FindBone ("arm-long");
     armShort = clock.skeleton.FindBone ("arm-short");
     needle = clock.skeleton.FindBone ("needle");
     Debug.Log (armLong);
     Debug.Log (armShort);
     Debug.Log (needle);
 }
开发者ID:harayoki,项目名称:m_clock,代码行数:13,代码来源:Clock.cs


示例15: ComputeWorldVertices

		/// <param name="worldVertices">Must have at least the same length as this attachment's vertices.</param>
		public void ComputeWorldVertices (Bone bone, float[] worldVertices) {
			float x = bone.skeleton.x + bone.worldX, y = bone.skeleton.y + bone.worldY;
			float m00 = bone.m00;
			float m01 = bone.m01;
			float m10 = bone.m10;
			float m11 = bone.m11;
			float[] vertices = this.vertices;
			for (int i = 0, n = vertices.Length; i < n; i += 2) {
				float px = vertices[i];
				float py = vertices[i + 1];
				worldVertices[i] = px * m00 + py * m01 + x;
				worldVertices[i + 1] = px * m10 + py * m11 + y;
			}
		}
开发者ID:ClazzX1,项目名称:BussStopOCD,代码行数:15,代码来源:BoundingBoxAttachment.cs


示例16: TransformConstraint

		public TransformConstraint (TransformConstraintData 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;
			rotateMix = data.rotateMix;
			translateMix = data.translateMix;
			scaleMix = data.scaleMix;
			shearMix = data.shearMix;

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


示例17: ComputeWorldVertices

		/// <param name="worldVertices">Must have at least the same length as this attachment's vertices.</param>
		public void ComputeWorldVertices (float x, float y, Bone bone, float[] worldVertices) {
			x += bone.worldX;
			y += bone.worldY;
			float m00 = bone.m00;
			float m01 = bone.m01;
			float m10 = bone.m10;
			float m11 = bone.m11;
			float[] vertices = Vertices;
			for (int i = 0, n = vertices.Length; i < n; i += 2) {
				float px = vertices[i];
				float py = vertices[i + 1];
				worldVertices[i] = px * m00 + py * m01 + x;
				worldVertices[i + 1] = px * m10 + py * m11 + y;
			}
		}
开发者ID:D021,项目名称:ink,代码行数:16,代码来源:BoundingBoxAttachment.cs


示例18: 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;
			rotateMix = data.rotateMix;
			scaleMix = data.scaleMix;
			shearMix = data.shearMix;
			offsetRotation = data.offsetRotation;
			offsetX = data.offsetX;
			offsetY = data.offsetY;
			offsetScaleX = data.offsetScaleX;
			offsetScaleY = data.offsetScaleY;
			offsetShearY = data.offsetShearY;

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


示例19: Start

    void Start () {
		game = GameObject.Find ("Gui").GetComponent<GameHandler> ();
		boxCollider = GetComponent<BoxCollider2D> ();
		character = GetComponent<MeshRenderer> ();
		controller = GetComponent<Controller2D> ();
		anim = GetComponent<SkeletonAnimation> ();
		skeleton = anim.skeleton;
		arm = skeleton.FindBone ("RShoulder");
		backArm = skeleton.FindBone ("LShoulder");

		weap = skeleton.FindBone ("Weapon");
		skelRend = GetComponent<SkeletonRenderer> ();
		skeleton.FindSlot ("WeaponImage").Attachment = null;
		anim.state.ClearTrack(1);
		controller.CatchPlayer (this);
		crouchTap = new TapInfo (.6f, int.MaxValue);
		dashTap = new TapInfo (.6f, int.MaxValue);

        //Initiate the width of the HP bar, this may need to be placed in the Update portion if window scaling is changed.
        width = healthbar.GetComponent<RectTransform>().rect.width;
		startMaxXPos = healthbar.GetComponent<RectTransform>().offsetMax.x;

        UpdateGravity();
	}
开发者ID:Myfi,项目名称:Barnyard_Splosion,代码行数:24,代码来源:Player.cs


示例20: SortPathConstraintAttachment

		private void SortPathConstraintAttachment (Attachment attachment, Bone slotBone) {
			if (!(attachment is PathAttachment)) return;
			int[] pathBones = ((PathAttachment)attachment).bones;
			if (pathBones == null)
				SortBone(slotBone);
			else {
				var bones = this.bones;
				for (int i = 0, n = pathBones.Length; i < n;) {
					int nn = pathBones[i++];
					nn += i;
					while (i < nn)
						SortBone(bones.Items[pathBones[i++]]);
				}
			}
		}
开发者ID:EsotericSoftware,项目名称:spine-runtimes,代码行数:15,代码来源:Skeleton.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# Spine.Skeleton类代码示例发布时间:2022-05-26
下一篇:
C# Spine.AnimationStateData类代码示例发布时间: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