本文整理匯總了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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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;
}
示例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();
}
示例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;
}