// the Update loop contains a very simple example of moving the character around and controlling the animation
    void Update()
    {
        if (player.GetActionState() != PlayerActionState.DEAD &&
            pauseState.instance.GetPauseState() != PAUSESTATE.PAUSED)
        {
            GetInput();

            CheckWall();

            // apply horizontal speed smoothing it. dont really do this with Lerp. Use SmoothDamp or something that provides more control
            var smoothedMovementFactor = _controller.isGrounded ? player.groundDamping : player.inAirDamping; // how fast do we change direction?
            _velocity.x = Mathf.Lerp(_velocity.x, normalizedHorizontalSpeed * player.moveSpeed, Time.deltaTime * smoothedMovementFactor);

            _velocity.y += player.gravity * Time.deltaTime;

            _controller.move(_velocity * Time.deltaTime);

            if (_controller._isGoingUpSlope && normalizedHorizontalSpeed > 0)
            {
                this.transform.position = new Vector3(transform.position.x, transform.position.y + _controller.skinWidth, transform.position.z);
            }

            // grab our current _velocity to use as a base for all calculations
            _velocity = _controller.velocity;

            Debug.Log("Grounded: " + _controller.isGrounded);

            Vector3 screenPos = Camera.main.WorldToScreenPoint(transform.position);

            screenPos.x = Mathf.Clamp(screenPos.x, 0f + clampOffset, Screen.width - clampOffset);
            screenPos.y = Mathf.Clamp(screenPos.y, 0f + clampOffset, Screen.height - clampOffset);

            transform.position = Camera.main.ScreenToWorldPoint(screenPos);
        }
    }
    // Update is called once per frame
    void Update()
    {
        if (player.GetActionState() == PlayerActionState.ATTACKING)
        {
            //Aim player at mouse
            //which direction is up
            Vector3 upAxis = new Vector3(0, 0, 1);
            Vector3 mouseScreenPosition = Input.mousePosition;

            //set mouses z to your targets
            mouseScreenPosition.z = transform.position.z;

            Vector3 mouseWorldSpace = Camera.main.ScreenToWorldPoint(mouseScreenPosition);

            transform.LookAt(mouseWorldSpace, upAxis);

            //zero out all rotations except the axis I want
            this.transform.eulerAngles = new Vector3(0, 0, (-transform.eulerAngles.z + 90) + mouseWorldSpace.z);
        }
    }
    // Update is called once per frame
    void Update()
    {
        /*
         * Check Move State
         */
        if (player.GetMoveState() == PlayerMoveState.RUNNING)
        {
            ClearMove();
            anim.SetBool("running", true);

            if (player.aim.GetFacingRight())
            {
                anim.SetFloat("direction", 1.0f);
            }
            else
            {
                anim.SetFloat("direction", -1.0f);
            }
        }
        else if (player.GetMoveState() == PlayerMoveState.SLIDING)
        {
            ClearMove();
            anim.SetBool("sliding", true);
        }
        else if (player.GetMoveState() == PlayerMoveState.MIDAIR)
        {
            ClearMove();
            anim.SetBool("midair", true);
        }
        else if (player.GetMoveState() == PlayerMoveState.JUMPING)
        {
            ClearMove();
            //anim.SetTrigger("jump");
        }
        else if (player.GetMoveState() == PlayerMoveState.DEAD)
        {
            ClearMove();
            anim.SetBool("dead", true);
        }

        /*
         * Check Action State
         */
        if (player.GetActionState() == PlayerActionState.ATTACKING)
        {
            ClearAction();
            anim.SetTrigger("attacking");
        }
        else if (player.GetActionState() == PlayerActionState.DODGING)
        {
            ClearAction();
            anim.SetBool("dodge", true);
        }
        else if (player.GetActionState() == PlayerActionState.DEAD)
        {
            ClearAction();
            anim.SetBool("dead", true);
        }
        else
        {
            ClearAction();
        }
    }