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


C# Skeleton.FindBone方法代码示例

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


在下文中一共展示了Skeleton.FindBone方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

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

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

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

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

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

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

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

示例8: Apply

	public void Apply () {
		isActive = true;
		skeleton = skeletonAnim.Skeleton;
		mix = 1;

		var ragdollRootBone = skeleton.FindBone(startingBoneName);
		startingBone = ragdollRootBone;
		RecursivelyCreateBoneProxies(ragdollRootBone);

		rootRigidbody = boneTable[ragdollRootBone].GetComponent<Rigidbody2D>();
		rootRigidbody.isKinematic = pinStartBone;
		rootRigidbody.mass = rootMass;

		List<Collider2D> boneColliders = new List<Collider2D>();

		foreach (var pair in boneTable) {
			var b = pair.Key;
			var t = pair.Value;
			Bone parentBone = null;
			Transform parentTransform = transform;

			boneColliders.Add(t.GetComponent<Collider2D>());

			if (b != startingBone) {
				parentBone = b.Parent;
				parentTransform = boneTable[parentBone];
			} else {
				ragdollRoot = new GameObject("RagdollRoot").transform;
				ragdollRoot.parent = transform;

				if (b == skeleton.RootBone) {
					ragdollRoot.localPosition = new Vector3(b.WorldX, b.WorldY, 0);
					ragdollRoot.localRotation = Quaternion.Euler(0, 0, GetCompensatedRotationIK(b));
					parentTransform = ragdollRoot;
				} else {
					ragdollRoot.localPosition = new Vector3(b.Parent.WorldX, b.Parent.WorldY, 0);
					ragdollRoot.localRotation = Quaternion.Euler(0, 0, GetCompensatedRotationIK(b.Parent));
					parentTransform = ragdollRoot;
				}

				rootOffset = t.position - transform.position;
			}

			var rbParent = parentTransform.GetComponent<Rigidbody2D>();

			if (rbParent != null) {
				var joint = t.gameObject.AddComponent<HingeJoint2D>();
				joint.connectedBody = rbParent;
				Vector3 localPos = parentTransform.InverseTransformPoint(t.position);
				localPos.x *= 1;
				joint.connectedAnchor = localPos;
				joint.GetComponent<Rigidbody2D>().mass = joint.connectedBody.mass * massFalloffFactor;
				JointAngleLimits2D limits = new JointAngleLimits2D();
				limits.min = -rotationLimit;
				limits.max = rotationLimit;
				joint.limits = limits;
				joint.useLimits = true;
			}
		}

		for (int x = 0; x < boneColliders.Count; x++) {
			for (int y = 0; y < boneColliders.Count; y++) {
				if (x == y) continue;
				Physics2D.IgnoreCollision(boneColliders[x], boneColliders[y]);
			}
		}

		var utilityBones = GetComponentsInChildren<SkeletonUtilityBone>();
		if (utilityBones.Length > 0) {
			List<string> destroyedUtilityBoneNames = new List<string>();
			foreach (var ub in utilityBones) {
				if (ub.mode == SkeletonUtilityBone.Mode.Override) {
					destroyedUtilityBoneNames.Add(ub.gameObject.name);
					Destroy(ub.gameObject);
				}
			}

			if (destroyedUtilityBoneNames.Count > 0) {
				string msg = "Destroyed Utility Bones: ";
				for (int i = 0; i < destroyedUtilityBoneNames.Count; i++) {
					msg += destroyedUtilityBoneNames[i];
					if (i != destroyedUtilityBoneNames.Count - 1) {
						msg += ",";
					}
				}
				Debug.LogWarning(msg);
			}
		}

		if (disableIK) {
			foreach (IkConstraint ik in skeleton.IkConstraints) {
				ik.Mix = 0;
			}
		}

		skeletonAnim.UpdateWorld += UpdateWorld;
	}
开发者ID:Kikkur,项目名称:spine-runtimes,代码行数:97,代码来源:SkeletonRagdoll2D.cs


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