Esempio n. 1
0
 private void Update()
 {
     if (pi.isWeaponVisible())
     {
         img.sprite = activeImage;
     }
     else if (!pi.isWeaponVisible())
     {
         img.sprite = inactiveImage;
     }
 }
    private void HandleAnimatorChanges()
    {
        if (anim != null && player != null)
        {
            if (state != animationState.BLOCKED_STATE)
            {
                if (player.velocity.magnitude == 0)
                {
                    state = animationState.IDLE;
                }
                else
                {
                    if (Input.GetKey(KeyCode.LeftShift))
                    {
                        state = animationState.RUNNING;
                    }
                    else
                    {
                        state = animationState.WALKING;
                    }
                }
                if (Input.GetKeyDown(Game_Manager.attack) && !inAnimatorState("Attack"))
                {
                    isAttackKeyDown = true;
                }
                if (isAttackKeyDown && playerInventory.isWeaponVisible())
                {
                    state = animationState.ATTACKING;
                }

                // TODO: Can add other animation states here, like a pickup animation etc.
            }
        }
    }