本文整理汇总了C#中Spine.AnimationStateData.SetMix方法的典型用法代码示例。如果您正苦于以下问题:C# AnimationStateData.SetMix方法的具体用法?C# AnimationStateData.SetMix怎么用?C# AnimationStateData.SetMix使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Spine.AnimationStateData
的用法示例。
在下文中一共展示了AnimationStateData.SetMix方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MakeSkeletonAndAnimationData
/*
*/
private void MakeSkeletonAndAnimationData()
{
if(sprites == null) {
Debug.LogWarning("Sprite collection not set for skeleton data asset: " + name,this);
return;
}
if(skeletonJSON == null) {
Debug.LogWarning("Skeleton JSON file not set for skeleton data asset: " + name,this);
return;
}
SkeletonJson json = new SkeletonJson(new tk2dSpineAttachmentLoader(sprites.spriteCollection));
json.Scale = scale;
try {
skeletonData = json.ReadSkeletonData(new StringReader(skeletonJSON.text));
} catch (Exception ex) {
Debug.Log("Error reading skeleton JSON file for skeleton data asset: " + name + "\n" + ex.Message + "\n" + ex.StackTrace,this);
return;
}
stateData = new AnimationStateData(skeletonData);
for(int i = 0, n = fromAnimation.Length; i < n; i++) {
if(fromAnimation[i].Length == 0 || toAnimation[i].Length == 0) continue;
stateData.SetMix(fromAnimation[i],toAnimation[i],duration[i]);
}
}
示例2: SetFadingSettings
/// <summary>
/// Wendet alle zum Skeleton passenden AnimationMixes auf animationStateData an.
/// </summary>
public static void SetFadingSettings(AnimationStateData pAnimationStateData)
{
List<AnimationMix> AnimationFadingList;
AnimationFadingList = AnimationFading[pAnimationStateData.SkeletonData.Name];
foreach (AnimationMix animMix in AnimationFadingList)
{
pAnimationStateData.SetMix(animMix.From, animMix.To, animMix.Fading);
}
}
示例3: GetSkeletonData
public SkeletonData GetSkeletonData(bool quiet)
{
if (atlasAsset == null) {
if (!quiet)
Debug.LogWarning("Atlas not set for skeleton data asset: " + name, this);
Clear();
return null;
}
if (skeletonJSON == null) {
if (!quiet)
Debug.LogWarning("Skeleton JSON file not set for skeleton data asset: " + name, this);
Clear();
return null;
}
Atlas atlas = atlasAsset.GetAtlas();
if (atlas == null) {
Clear();
return null;
}
if (skeletonData != null)
return skeletonData;
SkeletonJson json = new SkeletonJson(atlas);
json.Scale = scale;
try {
skeletonData = json.ReadSkeletonData(new StringReader(skeletonJSON.text));
} catch (Exception) {
if (!quiet)
Debug.LogException(new Exception("Error reading skeleton JSON file for skeleton data asset: " + name), this);
return null;
}
stateData = new AnimationStateData(skeletonData);
for (int i = 0, n = fromAnimation.Length; i < n; i++)
stateData.SetMix(fromAnimation[i], toAnimation[i], duration[i]);
return skeletonData;
}
示例4: GetSkeletonData
public SkeletonData GetSkeletonData (bool quiet) {
if (spriteCollection == null) {
if (!quiet)
Debug.LogError("Sprite collection not set for skeleton data asset: " + name, this);
Reset();
return null;
}
if (skeletonJSON == null) {
if (!quiet)
Debug.LogError("Skeleton JSON file not set for skeleton data asset: " + name, this);
Reset();
return null;
}
if (skeletonData != null)
return skeletonData;
SkeletonJson json = new SkeletonJson(new SpriteCollectionAttachmentLoader(spriteCollection));
json.Scale = 1.0f / (spriteCollection.invOrthoSize * spriteCollection.halfTargetHeight) * scale;
try {
skeletonData = json.ReadSkeletonData(new StringReader(skeletonJSON.text));
} catch (Exception ex) {
if (!quiet)
Debug.LogError("Error reading skeleton JSON file for SkeletonData asset: " + name + "\n" + ex.Message + "\n" + ex.StackTrace, this);
return null;
}
stateData = new AnimationStateData(skeletonData);
stateData.DefaultMix = defaultMix;
for (int i = 0, n = fromAnimation.Length; i < n; i++) {
if (fromAnimation[i].Length == 0 || toAnimation[i].Length == 0) continue;
stateData.SetMix(fromAnimation[i], toAnimation[i], duration[i]);
}
return skeletonData;
}
示例5: 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");
}
示例6: 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();
}
示例7: 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");
}
示例8: GetSkeletonData
public SkeletonData GetSkeletonData(bool quiet)
{
if (atlasAsset == null) {
if (!quiet)
Debug.LogError("Atlas not set for SkeletonData asset: " + name, this);
Clear();
return null;
}
if (skeletonJSON == null) {
if (!quiet)
Debug.LogError("Skeleton JSON file not set for SkeletonData asset: " + name, this);
Clear();
return null;
}
Atlas atlas = atlasAsset.GetAtlas();
if (atlas == null) {
Clear();
return null;
}
if (skeletonData != null)
return skeletonData;
SkeletonJson json = new SkeletonJson(atlas);
json.Scale = scale;
try {
skeletonData = json.ReadSkeletonData(new StringReader(skeletonJSON.text));
} catch (Exception ex) {
if (!quiet)
Debug.LogError("Error reading skeleton JSON file for SkeletonData asset: " + name + "\n" + ex.Message + "\n" + ex.StackTrace, this);
return null;
}
stateData = new AnimationStateData(skeletonData);
for (int i = 0, n = fromAnimation.Length; i < n; i++) {
if (fromAnimation[i].Length == 0 || toAnimation[i].Length == 0) continue;
stateData.SetMix(fromAnimation[i], toAnimation[i], duration[i]);
}
return skeletonData;
}
示例9: SetSkeletonData
public void SetSkeletonData(SkeletonData data)
{
this.skeletonData = data;
stateData = new AnimationStateData(skeletonData);
stateData.DefaultMix = defaultMix;
for (int i = 0, n = fromAnimation.Length; i < n; i++)
{
if (fromAnimation[i].Length == 0 || toAnimation[i].Length == 0) continue;
stateData.SetMix(fromAnimation[i], toAnimation[i], duration[i]);
}
}