Пример #1
0
 void Start()
 {
     if (sprite)
     {
         sprite.SetAnimation("idle");
     }
 }
Пример #2
0
    protected void spriteAnimationManager(float HorizInput, bool touchingGround)
    {
        if (!touchingGround)
        {
            spriteAnim.SetAnimation("jump");
            return;
        }

        if (vunrabilityFrames)
        {
            spriteAnim.SetAnimation("crush");
            return;
        }

        spriteAnim.SetAnimation(Mathf.Abs(HorizInput) > 0.1f ? "walk" : "idle");
        spriteAnim.SetFramesPerSecond(20);

        if (Mathf.Abs(HorizInput) > 0.1f && Mathf.Sign(xSpeed) != Mathf.Sign(HorizInput))
        {
            spriteAnim.SetFramesPerSecond(10);
            spriteAnim.SetAnimation("walk");
        }
    }