diff --git a/Assets/Scripts/Input/PlayerTouchController.cs b/Assets/Scripts/Input/PlayerTouchController.cs
index 8a853e77..125ce9db 100644
--- a/Assets/Scripts/Input/PlayerTouchController.cs
+++ b/Assets/Scripts/Input/PlayerTouchController.cs
@@ -12,7 +12,7 @@ namespace Input
// --- Movement State ---
private Vector3 targetPosition;
private Vector3 directMoveVelocity; // default is Vector3.zero
- private bool isHolding;
+ internal bool isHolding;
private Vector2 lastHoldPosition;
private Coroutine pathfindingDragCoroutine;
private float pathfindingDragUpdateInterval = 0.1f; // Interval in seconds
@@ -28,6 +28,10 @@ namespace Input
private Transform artTransform;
private SpriteRenderer spriteRenderer;
+ // --- Last direct movement direction ---
+ private Vector3 _lastDirectMoveDir = Vector3.right;
+ public Vector3 LastDirectMoveDir => _lastDirectMoveDir;
+
// --- MoveToAndNotify State ---
public delegate void ArrivedAtTargetHandler();
private Coroutine moveToCoroutine;
@@ -184,6 +188,9 @@ namespace Input
adjustedMove = toTarget;
}
transform.position += adjustedMove;
+
+ // Cache the last direct movement direction
+ _lastDirectMoveDir = directMoveVelocity.normalized;
}
///
diff --git a/Assets/Scripts/Interactions/ItemSlot.cs b/Assets/Scripts/Interactions/ItemSlot.cs
index 20dc9ba3..898ab082 100644
--- a/Assets/Scripts/Interactions/ItemSlot.cs
+++ b/Assets/Scripts/Interactions/ItemSlot.cs
@@ -107,7 +107,7 @@ namespace Interactions
{
if (itemToSlot == null)
{
- _currentlySlottedItemData = null;
+ _currentlySlottedItemObject = null;
_currentlySlottedItemData = null;
}
else
@@ -115,12 +115,11 @@ namespace Interactions
itemToSlot.SetActive(false);
itemToSlot.transform.SetParent(null);
SetSlottedObject(itemToSlot);
-
_currentlySlottedItemData = itemToSlotData;
- if (clearFollowerHeldItem)
- {
- FollowerController.ClearHeldItem();
- }
+ }
+ if (clearFollowerHeldItem)
+ {
+ FollowerController.ClearHeldItem();
}
UpdateSlottedSprite();
@@ -141,5 +140,17 @@ namespace Interactions
Interactable.BroadcastInteractionComplete(false);
}
}
+
+ void Update()
+ {
+ if (_currentlySlottedItemObject != null)
+ {
+ Debug.Log($"[ItemSlot] Slotted item: {_currentlySlottedItemObject.name}");
+ }
+ else
+ {
+ Debug.Log("[ItemSlot] No item slotted.");
+ }
+ }
}
}
diff --git a/Assets/Scripts/Movement/FollowerController.cs b/Assets/Scripts/Movement/FollowerController.cs
index 0fbb18a4..8ba3a42c 100644
--- a/Assets/Scripts/Movement/FollowerController.cs
+++ b/Assets/Scripts/Movement/FollowerController.cs
@@ -20,6 +20,7 @@ public class FollowerController: MonoBehaviour
///
public float manualMoveSmooth = 8f;
+ private GameObject _playerRef;
private Transform _playerTransform;
private AIPath _playerAIPath;
private AIPath _aiPath;
@@ -59,6 +60,8 @@ public class FollowerController: MonoBehaviour
public event FollowerPickupHandler OnPickupReturned;
private Coroutine _pickupCoroutine;
+ private Input.PlayerTouchController _playerTouchController;
+
void Awake()
{
_aiPath = GetComponent();
@@ -183,8 +186,10 @@ public class FollowerController: MonoBehaviour
GameObject playerObj = GameObject.FindGameObjectWithTag("Player");
if (playerObj != null)
{
+ _playerRef = playerObj;
_playerTransform = playerObj.transform;
_playerAIPath = playerObj.GetComponent();
+ _playerTouchController = playerObj.GetComponent();
if (_playerAIPath != null)
{
_playerMaxSpeed = _playerAIPath.maxSpeed;
@@ -196,6 +201,7 @@ public class FollowerController: MonoBehaviour
{
_playerTransform = null;
_playerAIPath = null;
+ _playerTouchController = null;
}
}
@@ -222,6 +228,11 @@ public class FollowerController: MonoBehaviour
moveDir = _playerAIPath.velocity.normalized;
_lastMoveDir = moveDir;
}
+ else if (_playerTouchController != null && _playerTouchController.isHolding && _playerTouchController.LastDirectMoveDir.sqrMagnitude > 0.01f)
+ {
+ moveDir = _playerTouchController.LastDirectMoveDir;
+ _lastMoveDir = moveDir;
+ }
else
{
moveDir = _lastMoveDir;