Esempio n. 1
0
    public void SetWalkAnimation()
    {
        bool animChanged = false;

        if (lastAnimX != last.x)
        {
            animChanged = true;
        }
        if (lastAnimY != last.y)
        {
            animChanged = true;
        }

        lastAnimX      = last.x;
        lastAnimY      = last.y;
        lastAnimMoving = isMoving;

        if (animChanged)
        {
            animTime = 0;
        }
        else
        {
            animTime += Time.deltaTime * ((moveSpeedCurrent > moveSpeed) ? 2f : 1f);
        }

        if (animHijack)
        {
            if (animTime > animationSet.GetAnimation(animationType).loopTime)
            {
                animHijack = false;
            }
        }
        else
        {
            if (animMoving)
            {
                animationType = "Walk";
            }
            else
            {
                animationType = "Idle";
            }
        }



        animIndex = animationSet.GetAnimationIndex(animationType, lookDirection, animTime);
        SetSprite();
        //animator.SetFloat("Horizontal", last.x);
        //animator.SetFloat("Vertical", last.y);
        //animator.SetBool("Moving", animMoving);
    }
Esempio n. 2
0
 // Update is called once per frame
 void Update()
 {
     if (sr.battleSetup.InBattle)
     {
         animTime += Time.deltaTime;
         if (currentSet != null)
         {
             animIndex    = currentSet.GetAnimationIndex(currentType, lookDirection, animTime);
             image.sprite = currentSet.GetAnimationSprite(currentType, animIndex);
             if (currentSet.isLunen && mirrorSprites)
             {
                 transform.localScale = mirroredVector3;
             }
             else
             {
                 transform.localScale = normalVector3;
             }
         }
     }
 }