Pulver trash maze sequence

This commit is contained in:
Michal Pikulski
2025-12-19 15:26:13 +01:00
parent 15c9ba0127
commit f0905f92d3
36 changed files with 2372 additions and 842 deletions

View File

@@ -406,6 +406,13 @@ namespace Input
while (!_interruptMoveTo)
{
// Use AIPath's built-in destination check if available
if (_aiPath != null && _aiPath.reachedDestination)
{
break;
}
// Fallback to distance check
Vector2 current2D = new Vector2(transform.position.x, transform.position.y);
Vector2 target2D = new Vector2(target.x, target.y);
float dist = Vector2.Distance(current2D, target2D);
@@ -425,6 +432,74 @@ namespace Input
}
#endregion
#region Controller Lifecycle
/// <summary>
/// Called when this controller is given input control.
/// Default implementation cleans up any active movement state.
/// Override to add controller-specific activation logic.
/// </summary>
public virtual void ActivateController()
{
// Stop any in-progress movement coroutines
if (_moveToCoroutine != null)
{
StopCoroutine(_moveToCoroutine);
_moveToCoroutine = null;
}
if (_pathfindingDragCoroutine != null)
{
StopCoroutine(_pathfindingDragCoroutine);
_pathfindingDragCoroutine = null;
}
// Reset movement state
_isHolding = false;
_directMoveVelocity = Vector3.zero;
_interruptMoveTo = false;
Logging.Debug($"[{GetType().Name}] Controller activated");
}
/// <summary>
/// Called when this controller loses input control.
/// Default implementation stops all movement and cleans up state.
/// Override to add controller-specific deactivation logic.
/// </summary>
public virtual void DeactivateController()
{
// Stop all movement coroutines
if (_moveToCoroutine != null)
{
StopCoroutine(_moveToCoroutine);
_moveToCoroutine = null;
}
if (_pathfindingDragCoroutine != null)
{
StopCoroutine(_pathfindingDragCoroutine);
_pathfindingDragCoroutine = null;
}
// Reset all movement state
_isHolding = false;
_directMoveVelocity = Vector3.zero;
_interruptMoveTo = false;
_isMoving = false;
// Stop AIPath movement
if (_aiPath != null)
{
_aiPath.enabled = false;
_aiPath.isStopped = true;
}
Logging.Debug($"[{GetType().Name}] Controller deactivated");
}
#endregion
}
}