本文整理匯總了C#中Spine.Skeleton.SetAttachment方法的典型用法代碼示例。如果您正苦於以下問題:C# Skeleton.SetAttachment方法的具體用法?C# Skeleton.SetAttachment怎麽用?C# Skeleton.SetAttachment使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Spine.Skeleton
的用法示例。
在下文中一共展示了Skeleton.SetAttachment方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: LoadContent
public void LoadContent(SkeletonRenderer sr, Atlas atlas, string json)
{
//blankTex = bt;
skeletonRenderer =sr;
SkeletonJson skjson = new SkeletonJson(atlas);
skeleton = new Skeleton(skjson.readSkeletonData("robo", json));
//skeleton.R = Tint.ToVector3().X;
//skeleton.G = Tint.ToVector3().Y;
//skeleton.B = Tint.ToVector3().Z;
Vector3 topColor = ClothesTint().ToVector3();
Vector3 bottomColor = ClothesTint().ToVector3();
Vector3 shoesColor = ClothesTint().ToVector3();
Vector3 skinColor = SkinTone().ToVector3();
Vector3 hairColor = HairColor().ToVector3();
if (IsCoPilot)
{
topColor = Color.Blue.ToVector3();
bottomColor = Color.Blue.ToVector3();
shoesColor = Color.DarkGray.ToVector3();
}
foreach (Slot s in skeleton.Slots)
{
if (s.Data.Name == "torso" ||
s.Data.Name=="arm-back-upper" ||
s.Data.Name == "arm-back-lower" ||
s.Data.Name== "arm-upper" ||
s.Data.Name =="arm-lower")
{
s.Data.R = topColor.X;
s.Data.G = topColor.Y;
s.Data.B = topColor.Z;
}
if (s.Data.Name == "leg-left" ||
s.Data.Name == "leg-right")
{
s.Data.R = bottomColor.X;
s.Data.G = bottomColor.Y;
s.Data.B = bottomColor.Z;
}
if (s.Data.Name == "foot-left" ||
s.Data.Name == "foot-right")
{
s.Data.R = shoesColor.X;
s.Data.G = shoesColor.Y;
s.Data.B = shoesColor.Z;
}
if (s.Data.Name == "head" ||
s.Data.Name == "hand" ||
s.Data.Name == "hand-copy")
{
s.Data.R = skinColor.X;
s.Data.G = skinColor.Y;
s.Data.B = skinColor.Z;
}
if (s.Data.Name == "hair")
{
s.Data.R = hairColor.X;
s.Data.G = hairColor.Y;
s.Data.B = hairColor.Z;
}
}
skeleton.SetSkin("default");
skeleton.SetSlotsToBindPose();
Animations.Add("walk", skeleton.Data.FindAnimation("walk"));
Animations.Add("punch-hold", skeleton.Data.FindAnimation("punch-hold"));
Animations.Add("punch-release", skeleton.Data.FindAnimation("punch-release"));
Animations.Add("knockback", skeleton.Data.FindAnimation("knockback"));
Animations.Add("pickup", skeleton.Data.FindAnimation("pickup"));
Animations.Add("knockout", skeleton.Data.FindAnimation("knockout"));
Animations.Add("panic", skeleton.Data.FindAnimation("panic"));
skeleton.RootBone.X = Position.X;
skeleton.RootBone.Y = Position.Y;
skeleton.RootBone.ScaleX = Scale;
skeleton.RootBone.ScaleY = Scale;
skeleton.UpdateWorldTransform();
skeleton.SetAttachment("melee-item", null);
skeleton.SetAttachment("hat", (IsCoPilot||IsPlayer)?"Pilot-Hat":null);
skeleton.SetAttachment("hair", (Helper.Random.Next(2)==0?"Hair-Male":"Hair-Female"));
skeleton.SetAttachment("chute", null);
//skeleton.FindSlot("fist-item").A = 0f;
HasParachute = false;
State = AIState.Panic;
}
示例2: LoadContent
protected override void LoadContent()
{
skeletonRenderer = new SkeletonRenderer(GraphicsDevice);
Atlas atlas = new Atlas("data/goblins.atlas", new XnaTextureLoader(GraphicsDevice));
SkeletonJson json = new SkeletonJson(atlas);
skeleton = new Skeleton(json.ReadSkeletonData("data/goblins.json"));
skeleton.SetSkin("goblingirl");
skeleton.SetSlotsToBindPose(); // Without this the skin attachments won't be attached. See SetSkin.
skeleton.SetAttachment("left hand item", "spear");
animation = skeleton.Data.FindAnimation("walk");
skeleton.RootBone.X = 320;
skeleton.RootBone.Y = 440;
skeleton.UpdateWorldTransform();
}