本文整理汇总了C#中SkeletonData.FindBone方法的典型用法代码示例。如果您正苦于以下问题:C# SkeletonData.FindBone方法的具体用法?C# SkeletonData.FindBone怎么用?C# SkeletonData.FindBone使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SkeletonData
的用法示例。
在下文中一共展示了SkeletonData.FindBone方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ReadSkeletonSlots
private void ReadSkeletonSlots(SkeletonData skeletonData, JObject data)
{
foreach (JToken slot in data["slots"].Children())
{
var slotName = (String) slot["name"];
var boneName = (String) slot["bone"];
BoneData boneData = skeletonData.FindBone(boneName);
if (boneData == null)
{
throw new SerializationException("Slot bone not found: " + boneName);
}
var slotData = new SlotData(slotName, boneData);
var color = (String) slot["color"];
if (color != null)
{
slotData.Color = ReadColor(color);
}
slotData.AttachmentName = (String) slot["attachment"];
skeletonData.AddSlot(slotData);
}
}
示例2: ReadSkeletonBones
private void ReadSkeletonBones(SkeletonData skeletonData, JObject data, float scale)
{
foreach (JToken bone in data["bones"].Children())
{
BoneData parent = null;
var parentName = (string) bone["parent"];
if (parentName != null)
{
parent = skeletonData.FindBone(parentName);
if (parent == null)
{
throw new SerializationException("Parent bone not found: " + parentName);
}
}
var boneData = new BoneData((String) bone["name"], parent);
boneData.Length = Read<float>(bone, "length", 0)*scale;
boneData.X = Read<float>(bone, "x", 0)*scale;
boneData.Y = Read<float>(bone, "y", 0)*scale;
boneData.Rotation = Read<float>(bone, "rotation", 0);
boneData.ScaleX = Read<float>(bone, "scaleX", 1);
boneData.ScaleY = Read<float>(bone, "scaleY", 1);
skeletonData.AddBone(boneData);
}
}