Pulver trash maze sequence
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using UnityEngine;
|
||||
using AppleHills.Core.Settings;
|
||||
using Core;
|
||||
using Core.Settings;
|
||||
|
||||
@@ -45,6 +44,10 @@ namespace Input
|
||||
InputManager.Instance.RegisterController("trafalgar", this, setAsDefaultConsumer: true);
|
||||
Logging.Debug($"[PlayerTouchController] Registered controller '{gameObject.name}' as default consumer");
|
||||
}
|
||||
|
||||
// Auto-activate as the default player controller
|
||||
ActivateController();
|
||||
Logging.Debug("[PlayerTouchController] Auto-activated as default player controller");
|
||||
}
|
||||
|
||||
#region IInteractingCharacter Override
|
||||
|
||||
Reference in New Issue
Block a user