• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# tk2dSpriteAnimator类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中tk2dSpriteAnimator的典型用法代码示例。如果您正苦于以下问题:C# tk2dSpriteAnimator类的具体用法?C# tk2dSpriteAnimator怎么用?C# tk2dSpriteAnimator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



tk2dSpriteAnimator类属于命名空间,在下文中一共展示了tk2dSpriteAnimator类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: FlameOnDelegate

    void FlameOnDelegate(tk2dSpriteAnimator animator, tk2dSpriteAnimationClip clip, int frameNumber)
    {
        if(clip.GetFrame(frameNumber).eventInfo.Equals("FlameOn"))
        {
            string fireTag = fireHitObject.tag;

            if (fireTag.Equals("Throwable"))
            {
                Vector3 position = fireHitObject.transform.position;
                position.z = charcoalParticleEffect.transform.position.z;

                // KILL THE PEASANTS
                Destroy(fireHitObject);

                // BURNINATE THE PEASANTS (particle effects)
                ParticleSystem localCharcoal = GameObject.Instantiate(charcoalParticleEffect, position, charcoalParticleEffect.transform.rotation) as ParticleSystem;
                localCharcoal.Play();
            }
            else if (fireTag.Equals("Player"))
            {
                // TODO: tell player to get bumped
            }
        }

        if(clip.GetFrame(frameNumber).eventInfo.Equals("DragonFootStep"))
        {
            AudioSource.PlayClipAtPoint(footSteps[Random.Range( 0, footSteps.Count )], transform.position);
        }
    }
开发者ID:poemdexter,项目名称:IndieSpeedRun2013,代码行数:29,代码来源:DragonBehavior.cs


示例2: Handle_YunMuAnimating

 void Handle_YunMuAnimating(tk2dSpriteAnimator sprite, tk2dSpriteAnimationClip clip, int frameNum)
 {
     tk2dSprite mspr  = sprite.GetComponent<tk2dSprite>( );
     Color c = mspr.color;
     c.a = mYunMuCurrentAlpha;
     mspr.color = c;
 }
开发者ID:minh3d,项目名称:Fish,代码行数:7,代码来源:ScenePrelude_FlowerEmit.cs


示例3: FireCompleteDelegate

 // done breathing fire, just walk again
 void FireCompleteDelegate(tk2dSpriteAnimator sprite, tk2dSpriteAnimationClip clip)
 {
     if(clip.name.Equals("Fire"))
     {
         anim.Play("Walk");
     }
 }
开发者ID:poemdexter,项目名称:IndieSpeedRun2013,代码行数:8,代码来源:DragonBehavior.cs


示例4: BeginAttack

    IEnumerator BeginAttack()
    {
        direction facing = FindDirection();
        ChooseAttackAnimation(facing);

        Vector3 posDifference = Player.position - Zombie.position;

        yield return new WaitForSeconds(0.1f);
        if(_state.curState != ZombieSM.ZombieState.Attack){
            yield break;
        }

        if(posDifference.x < 0){	// Left Attack
            Attack = (Transform)Instantiate(LeftAttack, Player.position, Quaternion.identity);
        }
        else{						// RightAttack
            Attack = (Transform)Instantiate(RightAttack, Player.position, Quaternion.identity);
        }
        Attack.transform.position += new Vector3(0, 0, -1);
        Attack.parent = transform;
        AttackAnim = Attack.GetComponent<tk2dSpriteAnimator>();

        PlayRandomAttackSound();
        AttackAnim.Play();
        _timeSinceLastAttack = Time.time + _attackDelay;				// Delays attack
        StartCoroutine(RemoveAttackAnimation());						// Remove attack animation when finished
        //print ("between 2 coroutines");
        StartCoroutine(MovementPause(1f));								// FIX, stop when out of detection range, but in chase mode.
    }
开发者ID:newmanwillis,项目名称:Dead_Week,代码行数:29,代码来源:ZombieAttackSlash.cs


示例5: Start

 // Use this for initialization
 void Start()
 {
     rb = GetComponent<Rigidbody2D>();
     audios = GetComponent<AudioSource>();
     target = GameObject.Find("test_player_3");
     anim = GetComponent<tk2dSpriteAnimator>();
 }
开发者ID:Nenekiri,项目名称:Heaven-s-Handyman,代码行数:8,代码来源:bimbytheBomb.cs


示例6: Handle_FishAniStop

 void Handle_FishAniStop(tk2dSpriteAnimator sprAni, tk2dSpriteAnimationClip aniClip)
 {
     if (mFish != null && mFish.Attackable)
     {
         mFish.AniSprite.PlayFrom(mOriginClip,0F);
     }
 }
开发者ID:minh3d,项目名称:Fish,代码行数:7,代码来源:Ef_PlayAnimationWhenEatFish.cs


示例7: Start

    // Use this for initialization
    void Start () {

        clock = GameObject.Find("SimpleClock");
        clock.SetActive(false); 
        anim = GetComponent<tk2dSpriteAnimator>();

}
开发者ID:Nenekiri,项目名称:Classified,代码行数:8,代码来源:CollisionCheck.cs


示例8: HandleMovementAnimations

    // Throwing animation takes priority over all others
    public void HandleMovementAnimations(PlayerMovement.Movement m)
    {
        if (anim == null) anim = GetComponent<tk2dSpriteAnimator>();
        string clip;

        // if we're ready to throw again and we pushed throw button
        if (!throwWait && isThrowing)
        {
            clip = "throw";
            anim.AnimationCompleted = ThrowCompleteDelegate;
            anim.AnimationEventTriggered = SpawnDaggerDelegate;
            throwWait = true;
            anim.Play(clip);
        }
        else if (!throwWait) // we're not mid throw animation so run other animations
        {
            if (m.jumping || m.inAir) clip = "jump";
            else if (m.moveHorizontal) clip = "walk";
            else clip = "still";
            if (prevRemoteClip != clip)
            {
                prevRemoteClip = clip;
                anim.Play(clip);
            }
        }
    }
开发者ID:poemdexter,项目名称:Rogue-BB,代码行数:27,代码来源:PlayerAnimation.cs


示例9: Start

 // Use this for initialization
 void Start()
 {
     anim = GetComponent<tk2dSpriteAnimator>();
     anim.Play("walking");
     distToGround = collider.bounds.extents.y;
     gravityTotal = gravity;
     sprite = GetComponent<tk2dSprite>();
 }
开发者ID:poemdexter,项目名称:2DToolkit-Game,代码行数:9,代码来源:DoctorScript.cs


示例10: OnAnimationClipEnd

    protected override void OnAnimationClipEnd(tk2dSpriteAnimator aAnim, tk2dSpriteAnimationClip aClip) {
        if(anim == aAnim && aClip == mClips[(int)AnimState.attack]) {
            mActActive = false;
            mFireActive = false;
        }

        base.OnAnimationClipEnd(aAnim, aClip);
    }
开发者ID:PushoN,项目名称:game-off-2013,代码行数:8,代码来源:WeaponWhip.cs


示例11: AnimationEventDelegate

		void AnimationEventDelegate (tk2dSpriteAnimator sprite, tk2dSpriteAnimationClip clip, int frameNum)
		{
			tk2dSpriteAnimationFrame frame = clip.GetFrame(frameNum);
			Fsm.EventData.IntData = frame.eventInt;
			Fsm.EventData.StringData = frame.eventInfo;
			Fsm.EventData.FloatData = frame.eventFloat;
			Fsm.Event(animationTriggerEvent);
		}
开发者ID:PushoN,项目名称:game-off-2013,代码行数:8,代码来源:Tk2dWatchAnimationEvents.cs


示例12: _getSprite

        private void _getSprite() {
            GameObject go = Fsm.GetOwnerDefaultTarget(gameObject);
            if(go == null) {
                return;
            }

            _sprite = go.GetComponent<tk2dSpriteAnimator>();
        }
开发者ID:PushoN,项目名称:game-off-2013,代码行数:8,代码来源:Tk2dGetAnimationClip.cs


示例13: OnSpawned

	void OnSpawned () {

		_spriteAnim = GetComponent<tk2dSpriteAnimator>();

		if (anim)
			_spriteAnim.PlayFromFrame(0);

		StartCoroutine (TimedDespawn());
	}
开发者ID:hiddenswitch,项目名称:Zombies,代码行数:9,代码来源:Despawn.cs


示例14: HitCompleteDelegate

 // This is called once the hit animation has compelted playing
 // It returns to playing whatever animation was active before hit
 // was playing.
 void HitCompleteDelegate(tk2dSpriteAnimator sprite, tk2dSpriteAnimationClip clip)
 {
     if (walking) {
         anim.Play("walk");
     }
     else {
         anim.Play("idle");
     }
 }
开发者ID:RainbowMin,项目名称:U3D-DrawRoad,代码行数:12,代码来源:TutorialAnimController.cs


示例15: Awake

    void Awake()
    {
        // Setting up references.
        groundCheck = transform.Find("groundCheck");

        anim = GetComponent<tk2dSpriteAnimator> ();

        jumpSound = GetComponent<AudioSource> ();
    }
开发者ID:savethejets,项目名称:Ludum-Dare-29,代码行数:9,代码来源:PlayerControl.cs


示例16: Awake

 void Awake()
 {
     mAnispr = GetComponent<tk2dSpriteAnimator>();
     if (mAnispr == null)
         return;
     mOriClip = mAnispr.DefaultClip;
     //mOriClipidx = mAnispr.DefaultClipId;
     tk2dSpriteAnimationClip aniClip = mAnispr.Library.clips[mAnispr.Library.GetClipIdByName(AniName)];
     mSpecAniLength = aniClip.frames.Length / aniClip.fps;
 }
开发者ID:minh3d,项目名称:Fish,代码行数:10,代码来源:Ef_tk2dAniSpecPlayInterval.cs


示例17: init

        //-------------------------------------------------------------------------
        public void init(CRenderScene scene)
        {
            mScene = scene;
            mSprite = gameObject.GetComponent<tk2dSprite>();
            mSpriteAnimator = gameObject.GetComponent<tk2dSpriteAnimator>();
            mTransform = transform;

            if (mSpriteAnimator == null) return;
            setKinematic();
        }
开发者ID:yinlei,项目名称:Fishing,代码行数:11,代码来源:StillSprite.cs


示例18: Awake

    void Awake()
    {
        groundCheck = transform.Find("GroundCheck");
        speedText = transform.Find("SpeedText").GetComponent<GUIText>();
        pGrind = GetComponent<PlayerGrind>();
        //anim = GetComponentInChildren<Animator>();

        //Animation
        playerAnimator = GetComponentInChildren<tk2dSpriteAnimator>();
    }
开发者ID:jrf0110,项目名称:skeleboarder,代码行数:10,代码来源:PlayerControl.cs


示例19: CheckAddAnimatorInternal

	void CheckAddAnimatorInternal() {
		if (_animator == null) {
			_animator = gameObject.GetComponent<tk2dSpriteAnimator>();
			if (_animator == null) {
				_animator = gameObject.AddComponent<tk2dSpriteAnimator>();
				_animator.Library = anim;
				_animator.DefaultClipId = clipId;
				_animator.playAutomatically = playAutomatically;
			}
		}
	}
开发者ID:pan4,项目名称:NewTD,代码行数:11,代码来源:tk2dAnimatedSprite.cs


示例20: Start

	// Use this for initialization
	void Start () 
	{
		animator = GetComponent<tk2dSpriteAnimator>();
		animator.AnimationEventTriggered += AnimationEventHandler;
		
#if UNITY_3_0 || UNITY_3_1 || UNITY_3_2 || UNITY_3_3 || UNITY_3_4 || UNITY_3_5 || UNITY_3_6 || UNITY_3_7 || UNITY_3_8 || UNITY_3_9
		popupTextMesh.gameObject.active = false;
#else
		popupTextMesh.gameObject.SetActive(false);
#endif
	}
开发者ID:rlugojr,项目名称:Chromacore,代码行数:12,代码来源:tk2dDemoAnimController.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# tk2dSpriteCollection类代码示例发布时间:2022-05-24
下一篇:
C# tk2dSpriteAnimationClip类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap