Example #1
0
        protected override void ComputeVelocity()
        {
#if USING_INPUT_OLD
            Vector2 move = Vector2.zero;
            move.x = ControllerInputManager.GetRawHorizontal();
#endif
            float moveX = move.x;

            OnCharacterState();

            if (moveX > 0 && InputRight(inputDirection))
            {
                this.facingState = Right();
            }
            else if (moveX < 0 && InputLeft(inputDirection))
            {
                this.facingState = Left();
            }

            OnFacingState();

            animator.SetBool(GROUNDED, IsGrounded(state));
            animator.SetFloat(VELOCITY_X, Mathf.Abs(velocity.x) / maxSpeed);

            targetVelocity = move * maxSpeed;
        }