Exemplo n.º 1
0
    void WalkAnim()
    {
        float inputX      = Input.GetAxisRaw("Horizontal");
        bool  isColliding = PlayerChecks.WallCollision(PlayerInfo.colliderCenter, PlayerInfo.colliderExtents, inputX);
        bool  needFlip;

        PlayerInfo.facing = (int)inputX;
        animator.SetFloat("Speed", Mathf.Abs(inputX));
        if (PlayerInfo.isColliding && PlayerInfo.isGrounded && Input.GetAxisRaw("Horizontal") != 0)
        {
            AnimPlay("Pushing");
        }
        else if (PlayerInfo.isColliding)
        {
            animator.SetFloat("Speed", 0);
        }
        needFlip             = PlayerInfo.facing == 1 ? false : true;
        spriteRenderer.flipX = needFlip;
    }