当前位置: 首页>>代码示例>>C#>>正文


C# AnimationState.SetAnimation方法代码示例

本文整理汇总了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);
    }
开发者ID:hzvs009,项目名称:spine-runtimes,代码行数:7,代码来源:SkeletonAnimation.cs

示例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);
	}
开发者ID:rtumelty,项目名称:toyrescuestory,代码行数:8,代码来源:SkeletonAnimation.cs

示例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);
		}
	}
开发者ID:Bee-Cave-Games,项目名称:spine-runtimes,代码行数:10,代码来源:SkeletonAnimation.cs

示例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);
 }
开发者ID:harayoki,项目名称:m_clock,代码行数:13,代码来源:Clock.cs

示例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();
        }
开发者ID:ThirdPartyNinjas,项目名称:NinjaSharp,代码行数:16,代码来源:TestGame.cs

示例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");
        }
开发者ID:jaimeBokoko,项目名称:spine-runtimes,代码行数:42,代码来源:ExampleGame.cs

示例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();
        }
开发者ID:CalPeterWu,项目名称:spine-runtimes,代码行数:28,代码来源:ExampleGame.cs

示例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");
		}
开发者ID:Lucius0,项目名称:spine-runtimes,代码行数:60,代码来源:ExampleGame.cs

示例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
	}
开发者ID:Sky-J,项目名称:spine-runtimes,代码行数:26,代码来源:SkeletonAnimation.cs

示例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);
		}
开发者ID:EsotericSoftware,项目名称:spine-runtimes,代码行数:27,代码来源:SkeletonGraphic.cs


注:本文中的Spine.AnimationState.SetAnimation方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。