Finalize work on the dump controller switching

This commit is contained in:
Michal Pikulski
2025-12-15 10:18:43 +01:00
parent b14fdfbe68
commit 5b33eb8fbb
9 changed files with 211 additions and 1258 deletions

View File

@@ -330,6 +330,31 @@ namespace Input
#region IInteractingCharacter Implementation
/// <summary>
/// Controller-driven interaction movement. Base implementation moves this controller to the interactable.
/// Override in derived classes for custom behavior (e.g., PlayerTouchController handles follower dispatch).
/// </summary>
public virtual async System.Threading.Tasks.Task<bool> MoveToInteractableAsync(Interactions.InteractableBase interactable)
{
// Default behavior: move self to interactable position
Vector3 targetPosition = interactable.transform.position;
// Check for custom CharacterMoveToTarget
var moveTargets = interactable.GetComponentsInChildren<Interactions.CharacterMoveToTarget>();
foreach (var target in moveTargets)
{
if (target.characterType == Interactions.CharacterToInteract.Trafalgar ||
target.characterType == Interactions.CharacterToInteract.Both)
{
targetPosition = target.GetTargetPosition();
break;
}
}
// Use MovementUtilities to handle movement
return await Utils.MovementUtilities.MoveToPositionAsync(this, targetPosition);
}
/// <summary>
/// Moves the character to a specific target position and notifies via events when arrived or cancelled.
/// This is used by systems like interactions to orchestrate scripted movement.