void Update()
    {
        PlayerControlsMouse controls = PlayerControlsMouse.Get();

        float target_alpha = controls.IsJoystickActive() ? 1f : 0f;

        canvas.alpha = Mathf.MoveTowards(canvas.alpha, target_alpha, 4f * Time.deltaTime);

        Vector2 screenPos = controls.GetJoystickPos();

        rect.anchoredPosition = TheUI.Get().ScreenPointToCanvasPos(screenPos);
        pin.anchoredPosition  = controls.GetJoystickDir() * 50f;
    }
    void FixedUpdate()//프레임과 상관없이 일정 시간의 지나면 실행됨 update보다 자주 실행됨, 물리적 구현 사용
    {
        if (TheGame.Get().IsPaused())
        {
            rigid.velocity = Vector3.zero;
            return;
        }

        if (is_dead)
        {
            return;
        }


        //죽지 않으면 실행되는 구현
        PlayerControls      controls  = PlayerControls.Get();
        PlayerControlsMouse mcontrols = PlayerControlsMouse.Get();
        Vector3             tmove     = Vector3.zero;

        //Navmesh
        if (auto_move && use_navmesh && path_found && path_index < nav_paths.Length)
        {
            auto_move_target_next = nav_paths[path_index];
            Vector3 move_dir_total = auto_move_target_next - transform.position;
            move_dir_total.y = 0f;
            if (move_dir_total.magnitude < 0.2f)
            {
                path_index++;
            }
        }

        //Moving
        auto_move_timer += Time.fixedDeltaTime;
        if (auto_move && auto_move_timer > 0.02f)
        {
            if (!use_navmesh || !calculating_path)
            {
                Vector3 move_dir_total = auto_move_target - transform.position;
                Vector3 move_dir_next  = auto_move_target_next - transform.position;
                Vector3 move_dir       = move_dir_next.normalized * Mathf.Min(move_dir_total.magnitude, 1f);
                move_dir.y = 0f;

                float move_dist = Mathf.Min(move_speed * move_speed_mult, move_dir.magnitude * 10f);
                tmove = move_dir.normalized * move_dist;
            }
        }
        else
        {
            Vector3 cam_move = TheCamera.Get().GetRotation() * controls.GetMove();
            if (mcontrols.IsJoystickActive())
            {
                Vector2 joystick = mcontrols.GetJoystickDir();
                cam_move = TheCamera.Get().GetRotation() * new Vector3(joystick.x, 0f, joystick.y);
            }
            tmove = cam_move * move_speed * move_speed_mult;
        }

        if (is_action)
        {
            tmove = Vector3.zero;
        }

        DetectGrounded();

        //Falling
        if (!is_grounded)
        {
            tmove += Vector3.down * fall_speed;
        }

        //Do move
        move           = Vector3.Lerp(move, tmove, move_accel * Time.fixedDeltaTime);
        rigid.velocity = move;

        //Facing
        if (!is_action && IsMoving())
        {
            facing = new Vector3(move.x, 0f, move.z).normalized;
        }

        Quaternion targ_rot = Quaternion.LookRotation(facing, Vector3.up);

        rigid.MoveRotation(Quaternion.RotateTowards(rigid.rotation, targ_rot, rotate_speed * Time.fixedDeltaTime));

        //Fronted
        DetectFronted();

        //Traveled calcul
        Vector3 last_frame_travel = transform.position - prev_pos;

        move_average = Vector3.MoveTowards(move_average, last_frame_travel, 1f * Time.fixedDeltaTime);
        prev_pos     = transform.position;

        //Stop auto move
        bool stuck_somewhere = (move_average.magnitude < 0.02f) && (auto_move_timer > 1f);

        if (stuck_somewhere)
        {
            StopMove();
        }

        if (controls.IsMoving() || mcontrols.IsJoystickActive())
        {
            StopAction();
        }
    }