本文整理汇总了C#中Spine.AnimationState.AddAnimation方法的典型用法代码示例。如果您正苦于以下问题:C# AnimationState.AddAnimation方法的具体用法?C# AnimationState.AddAnimation怎么用?C# AnimationState.AddAnimation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Spine.AnimationState
的用法示例。
在下文中一共展示了AnimationState.AddAnimation方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LoadContent
protected override void LoadContent()
{
skeletonRenderer = new SkeletonRenderer(GraphicsDevice);
String name = "spineboy"; // "goblins";
Atlas atlas = new Atlas("data/" + name + ".atlas", new XnaTextureLoader(GraphicsDevice));
SkeletonJson json = new SkeletonJson(atlas);
skeleton = new Skeleton(json.ReadSkeletonData("data/" + name + ".json"));
if (name == "goblins") skeleton.SetSkin("goblingirl");
skeleton.SetSlotsToBindPose(); // Without this the skin attachments won't be attached. See SetSkin.
// Define mixing between animations.
AnimationStateData stateData = new AnimationStateData(skeleton.Data);
if (name == "spineboy") {
stateData.SetMix("walk", "jump", 0.2f);
stateData.SetMix("jump", "walk", 0.4f);
}
state = new AnimationState(stateData);
state.SetAnimation("walk", false);
state.AddAnimation("jump", false);
state.AddAnimation("walk", true);
skeleton.RootBone.X = 320;
skeleton.RootBone.Y = 440;
skeleton.UpdateWorldTransform();
}
示例2: LoadContent
protected override void LoadContent()
{
skeletonRenderer = new SkeletonRenderer(GraphicsDevice);
String name = "spineboy"; // "goblins";
Atlas atlas = new Atlas("data/" + name + ".atlas", new XnaTextureLoader(GraphicsDevice));
SkeletonJson json = new SkeletonJson(atlas);
skeleton = new Skeleton(json.ReadSkeletonData("data/" + name + ".json"));
if (name == "goblins") skeleton.SetSkin("goblingirl");
skeleton.SetSlotsToSetupPose(); // Without this the skin attachments won't be attached. See SetSkin.
// Define mixing between animations.
AnimationStateData stateData = new AnimationStateData(skeleton.Data);
if (name == "spineboy") {
stateData.SetMix("walk", "jump", 0.2f);
stateData.SetMix("jump", "walk", 0.4f);
}
state = new AnimationState(stateData);
if (true) {
// Event handling for all animations.
state.Start += new EventHandler(Start);
state.End += new EventHandler(End);
state.Complete += new EventHandler<CompleteArgs>(Complete);
state.Event += new EventHandler<EventTriggeredArgs>(Event);
state.SetAnimation("drawOrder", true);
} else {
state.SetAnimation("walk", false);
QueueEntry entry = state.AddAnimation("jump", false);
entry.End += new EventHandler(End); // Event handling for queued animations.
state.AddAnimation("walk", true);
}
skeleton.X = 320;
skeleton.Y = 440;
skeleton.UpdateWorldTransform();
headSlot = skeleton.FindSlot("head");
}
示例3: LoadContent
protected override void LoadContent () {
skeletonRenderer = new SkeletonMeshRenderer(GraphicsDevice);
skeletonRenderer.PremultipliedAlpha = true;
// String name = "spineboy";
// String name = "goblins-mesh";
String name = "raptor";
bool binaryData = true;
Atlas atlas = new Atlas(assetsFolder + name + ".atlas", new XnaTextureLoader(GraphicsDevice));
float scale = 1;
if (name == "spineboy") scale = 0.6f;
if (name == "raptor") scale = 0.5f;
SkeletonData skeletonData;
if (binaryData) {
SkeletonBinary binary = new SkeletonBinary(atlas);
binary.Scale = scale;
skeletonData = binary.ReadSkeletonData(assetsFolder + name + ".skel");
} else {
SkeletonJson json = new SkeletonJson(atlas);
json.Scale = scale;
skeletonData = json.ReadSkeletonData(assetsFolder + name + ".json");
}
skeleton = new Skeleton(skeletonData);
if (name == "goblins-mesh") skeleton.SetSkin("goblin");
// Define mixing between animations.
AnimationStateData stateData = new AnimationStateData(skeleton.Data);
state = new AnimationState(stateData);
if (name == "spineboy") {
stateData.SetMix("run", "jump", 0.2f);
stateData.SetMix("jump", "run", 0.4f);
// Event handling for all animations.
state.Start += Start;
state.End += End;
state.Complete += Complete;
state.Event += Event;
state.SetAnimation(0, "test", false);
TrackEntry entry = state.AddAnimation(0, "jump", false, 0);
entry.End += End; // Event handling for queued animations.
state.AddAnimation(0, "run", true, 0);
} else if (name == "raptor") {
state.SetAnimation(0, "walk", true);
state.SetAnimation(1, "empty", false);
state.AddAnimation(1, "gungrab", false, 2);
} else {
state.SetAnimation(0, "walk", true);
}
skeleton.X = 400;
skeleton.Y = 590;
skeleton.UpdateWorldTransform();
headSlot = skeleton.FindSlot("head");
}