miepzerino
2023-12-15 448b5092206ccd9db760b00aeb9ab2233270bd6e
Assets/Scripts/PlayerController.cs
@@ -24,7 +24,7 @@
        private set
        {
            _isMoving = value;
            animator.SetBool(AnimationStrings.Player.IsMoving, value);
            animator.SetBool(AnimationStrings.Player.isMoving, value);
        }
    }
@@ -36,8 +36,8 @@
        private set
        {
            _isFlying = value;
            animator.SetBool(AnimationStrings.Player.IsFlying, value);
            animator_rotor.SetBool(AnimationStrings.Player.IsFlying, value);
            animator.SetBool(AnimationStrings.Player.isFlying, value);
            animator_rotor.SetBool(AnimationStrings.Player.isFlying, value);
        }
    }
@@ -56,24 +56,20 @@
        }
    }
    public bool CanMove { get
        {
            return animator.GetBool(AnimationStrings.canMove);
        }
    }
    private void Awake()
    {
        rb = GetComponent<Rigidbody2D>();
        animator = GetComponent<Animator>();
        animator_rotor = rotorGO.GetComponent<Animator>();
        touchingDirections = GetComponent<TouchingDirections>();
    }
    // Start is called before the first frame update
    void Start()
    {
    }
    // Update is called once per frame
    void Update()
    {
    }
    private void FixedUpdate()
@@ -108,6 +104,8 @@
    public void OnMove(InputAction.CallbackContext context)
    {
        if (CanMove)
        {
        moveInput = context.ReadValue<Vector2>();
        IsMoving = moveInput.x != 0;
@@ -115,7 +113,13 @@
        IsFlying = (moveInput.y != 0);
        SetFacingDirection(moveInput);
        }
        else
        {
            IsMoving = false;
            IsFlying = false;
            moveInput = Vector2.zero;
        }
    }
    private void SetFacingDirection(Vector2 moveInput)