Exemple #1
0
 public void Play(Anims nextAnimation)
 {
     // Si l'animation est déjà jouée, on ne fait rien
     if (currentAnimation.name == nextAnimation)
     {
         return;
     }
     // trouve l'animation correspondante dans la liste
     currentAnimation = animations.First(a => a.name == nextAnimation);
     // réinitialise à la première image de la séquence
     currentFrameIndex = 0;
     loopCount         = 0;
 }
Exemple #2
0
 void Start()
 {
     spriteRenderer    = GetComponent <SpriteRenderer>();
     nextFrameCoolDown = animationFrameDuration;
     currentAnimation  = animations[0];
 }