本文整理汇总了C#中tk2dSpriteAnimator类的典型用法代码示例。如果您正苦于以下问题:C# tk2dSpriteAnimator类的具体用法?C# tk2dSpriteAnimator怎么用?C# tk2dSpriteAnimator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
tk2dSpriteAnimator类属于命名空间,在下文中一共展示了tk2dSpriteAnimator类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
}
示例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;
}
示例3: FireCompleteDelegate
// done breathing fire, just walk again
void FireCompleteDelegate(tk2dSpriteAnimator sprite, tk2dSpriteAnimationClip clip)
{
if(clip.name.Equals("Fire"))
{
anim.Play("Walk");
}
}
示例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.
}
示例5: Start
// Use this for initialization
void Start()
{
rb = GetComponent<Rigidbody2D>();
audios = GetComponent<AudioSource>();
target = GameObject.Find("test_player_3");
anim = GetComponent<tk2dSpriteAnimator>();
}
示例6: Handle_FishAniStop
void Handle_FishAniStop(tk2dSpriteAnimator sprAni, tk2dSpriteAnimationClip aniClip)
{
if (mFish != null && mFish.Attackable)
{
mFish.AniSprite.PlayFrom(mOriginClip,0F);
}
}
示例7: Start
// Use this for initialization
void Start () {
clock = GameObject.Find("SimpleClock");
clock.SetActive(false);
anim = GetComponent<tk2dSpriteAnimator>();
}
示例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);
}
}
}
示例9: Start
// Use this for initialization
void Start()
{
anim = GetComponent<tk2dSpriteAnimator>();
anim.Play("walking");
distToGround = collider.bounds.extents.y;
gravityTotal = gravity;
sprite = GetComponent<tk2dSprite>();
}
示例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);
}
示例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);
}
示例12: _getSprite
private void _getSprite() {
GameObject go = Fsm.GetOwnerDefaultTarget(gameObject);
if(go == null) {
return;
}
_sprite = go.GetComponent<tk2dSpriteAnimator>();
}
示例13: OnSpawned
void OnSpawned () {
_spriteAnim = GetComponent<tk2dSpriteAnimator>();
if (anim)
_spriteAnim.PlayFromFrame(0);
StartCoroutine (TimedDespawn());
}
示例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");
}
}
示例15: Awake
void Awake()
{
// Setting up references.
groundCheck = transform.Find("groundCheck");
anim = GetComponent<tk2dSpriteAnimator> ();
jumpSound = GetComponent<AudioSource> ();
}