本文整理汇总了C#中Spine.AnimationState.SetAnimation方法的典型用法代码示例。如果您正苦于以下问题:C# AnimationState.SetAnimation方法的具体用法?C# AnimationState.SetAnimation怎么用?C# AnimationState.SetAnimation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Spine.AnimationState
的用法示例。
在下文中一共展示了AnimationState.SetAnimation方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Initialize
public override void Initialize()
{
base.Initialize(); // Call overridden method to initialize the skeleton.
state = new Spine.AnimationState(skeletonDataAsset.GetAnimationStateData());
if (_animationName != null && _animationName.Length > 0) state.SetAnimation(0, _animationName, loop);
}
示例2: Initialize
override public void Initialize () {
if (Initialized) return;
base.Initialize();
state = new Spine.AnimationState(skeletonDataAsset.GetAnimationStateData());
if (_animationName != null && _animationName.Length > 0) state.SetAnimation(0, _animationName, loop);
}
示例3: Reset
public override void Reset () {
base.Reset();
if (!valid) return;
state = new Spine.AnimationState(skeletonDataAsset.GetAnimationStateData());
if (_animationName != null && _animationName.Length > 0) {
state.SetAnimation(0, _animationName, loop);
Update(0);
}
}
示例4: Start
void Start()
{
clock = GetComponent<SkeletonAnimation>();
clockState = clock.state;
clockState.TimeScale = 1.0f;
clockState.SetAnimation(0, "loop", true);
armLong = clock.skeleton.FindBone ("arm-long");
armShort = clock.skeleton.FindBone ("arm-short");
needle = clock.skeleton.FindBone ("needle");
Debug.Log (armLong);
Debug.Log (armShort);
Debug.Log (needle);
}
示例5: LoadContent
protected override void LoadContent()
{
Effect spriteBatchEffect = Content.Load<Effect>("SpriteBatchEffect");
spriteBatch = new SpriteBatchEx(GraphicsDevice, spriteBatchEffect);
Bone.yDown = true;
skeletonData = Content.Load<SkeletonData>("spineboy/spineboy");
skeleton = new Skeleton(skeletonData);
skeleton.SetSlotsToSetupPose();
AnimationStateData stateData = new AnimationStateData(skeleton.Data);
animationState = new AnimationState(stateData);
animationState.SetAnimation(0, "walk", true);
skeleton.UpdateWorldTransform();
}
示例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.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");
}
示例7: 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();
}
示例8: 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");
}
示例9: Reset
public override void Reset () {
base.Reset();
if (!valid)
return;
state = new Spine.AnimationState(skeletonDataAsset.GetAnimationStateData());
#if UNITY_EDITOR
if (!string.IsNullOrEmpty(_animationName)) {
if (Application.isPlaying) {
state.SetAnimation(0, _animationName, loop);
} else {
// Assume SkeletonAnimation is valid for skeletonData and skeleton. Checked above.
var animationObject = skeletonDataAsset.GetSkeletonData(false).FindAnimation(_animationName);
if (animationObject != null)
animationObject.Apply(skeleton, 0f, 0f, false, null);
}
Update(0);
}
#else
if (!string.IsNullOrEmpty(_animationName)) {
state.SetAnimation(0, _animationName, loop);
Update(0);
}
#endif
}
示例10: Initialize
public void Initialize (bool overwrite) {
if (this.IsValid && !overwrite) return;
// Make sure none of the stuff is null
if (this.skeletonDataAsset == null) return;
var skeletonData = this.skeletonDataAsset.GetSkeletonData(false);
if (skeletonData == null) return;
if (skeletonDataAsset.atlasAssets.Length <= 0 || skeletonDataAsset.atlasAssets[0].materials.Length <= 0) return;
this.state = new Spine.AnimationState(skeletonDataAsset.GetAnimationStateData());
if (state == null) {
Clear();
return;
}
this.skeleton = new Skeleton(skeletonData);
this.spineMeshGenerator = new Spine.Unity.MeshGeneration.ArraysSimpleMeshGenerator(); // You can switch this out with any other implementer of Spine.Unity.MeshGeneration.ISimpleMeshGenerator
this.spineMeshGenerator.PremultiplyVertexColors = true;
// Set the initial Skin and Animation
if (!string.IsNullOrEmpty(initialSkinName))
skeleton.SetSkin(initialSkinName);
if (!string.IsNullOrEmpty(startingAnimation))
state.SetAnimation(0, startingAnimation, startingLoop);
}