public void PlayAnimationCPeonFem(CPeonFem c, float frameRate, int times, int flip, bool goOn, bool reverse) { frameArray = gameAssets.GetCPeonFemAnimationSprite(c); loopCounter = 0; isPlaying = true; if (!goOn) { // Debug.Log("赋值为0"); reserve = reverse; this.frameRate = frameRate; currentFrame = 0; timer = 0f; this.times = times; if (reverse) { spriteRenderer.sprite = frameArray[frameArray.Length - currentFrame - 1]; } else { spriteRenderer.sprite = frameArray[currentFrame]; } //判断是否翻转 if (flip == 1) { spriteRenderer.flipX = true; } else if (flip == 2) { spriteRenderer.flipY = true; } else { spriteRenderer.flipX = false; spriteRenderer.flipY = false; } } }
public Sprite[] GetCPeonFemAnimationSprite(CPeonFem cPeonFem) { switch (cPeonFem) { case CPeonFem.Dead: return(cPeonFemDead); case CPeonFem.WalkRight: return(cPeonFemWalkRight); case CPeonFem.WalkLeft: return(cPeonFemWalkLeft); case CPeonFem.WalkBottom: return(cPeonFemWalkBottom); case CPeonFem.WalkTop: return(cPeonFemWalkTop); case CPeonFem.Drink: return(cPeonFemDrink); case CPeonFem.HitFromRight: return(cPeonFemHitFromRight); case CPeonFem.HitFromLeft: return(cPeonFemHitFromLeft); case CPeonFem.HitFromBottom: return(cPeonFemHitFromBottom); case CPeonFem.HitFromTop: return(cPeonFemHitFromTop); case CPeonFem.IdleToRight: return(cPeonFemIdleToRight); case CPeonFem.IdleToLeft: return(cPeonFemIdleToLeft); case CPeonFem.IdleToBottom: return(cPeonFemIdleToBottom); case CPeonFem.IdleToTop: return(cPeonFemIdleToTop); case CPeonFem.Item: return(cPeonFemItem); case CPeonFem.Pray: return(cPeonFemPray); case CPeonFem.SwingRight: return(cPeonFemSwingRight); case CPeonFem.SwingLeft: return(cPeonFemSwingLeft); case CPeonFem.SwingBottom: return(cPeonFemSwingBottom); case CPeonFem.SwingTop: return(cPeonFemSwingTop); case CPeonFem.SwipeRight: return(cPeonFemSwipeRight); case CPeonFem.SwipeLeft: return(cPeonFemSwipeLeft); case CPeonFem.SwipeBottom: return(cPeonFemSwipeBottom); case CPeonFem.SwipeTop: return(cPeonFemSwipeTop); case CPeonFem.ThrowRight: return(cPeonFemThrowRight); case CPeonFem.ThrowLeft: return(cPeonFemThrowLeft); case CPeonFem.ThrowBottom: return(cPeonFemThrowBottom); case CPeonFem.ThrowTop: return(cPeonFemThrowTop); default: return(null); } }