Add skip functionality to Cinematics Manager

This commit is contained in:
Michal Pikulski
2025-10-13 09:22:18 +02:00
parent f150ad0ce4
commit ab84c97675
11 changed files with 753 additions and 22 deletions

View File

@@ -31,6 +31,9 @@ namespace Input
// Override consumer stack - using a list to support multiple overrides that can be removed in LIFO order
private readonly List<ITouchInputConsumer> _overrideConsumers = new List<ITouchInputConsumer>();
// Track which consumer is handling the current hold operation
private ITouchInputConsumer _activeHoldConsumer;
public static InputManager Instance
{
get
@@ -193,6 +196,18 @@ namespace Input
Vector3 worldPos = Camera.main.ScreenToWorldPoint(screenPos);
Vector2 worldPos2D = new Vector2(worldPos.x, worldPos.y);
Debug.Log($"[InputManager] HoldMove started at {worldPos2D}");
// First check for override consumers
if (_overrideConsumers.Count > 0)
{
_activeHoldConsumer = _overrideConsumers[_overrideConsumers.Count - 1];
Debug.Log($"[InputManager] Hold delegated to override consumer: {_activeHoldConsumer}");
_activeHoldConsumer.OnHoldStart(worldPos2D);
return;
}
// If no override consumers, use default consumer
_activeHoldConsumer = defaultConsumer;
defaultConsumer?.OnHoldStart(worldPos2D);
}
@@ -207,7 +222,10 @@ namespace Input
Vector3 worldPos = Camera.main.ScreenToWorldPoint(screenPos);
Vector2 worldPos2D = new Vector2(worldPos.x, worldPos.y);
Debug.Log($"[InputManager] HoldMove canceled at {worldPos2D}");
defaultConsumer?.OnHoldEnd(worldPos2D);
// Notify the active hold consumer that the hold has ended
_activeHoldConsumer?.OnHoldEnd(worldPos2D);
_activeHoldConsumer = null;
}
/// <summary>
@@ -221,7 +239,9 @@ namespace Input
Vector3 worldPos = Camera.main.ScreenToWorldPoint(screenPos);
Vector2 worldPos2D = new Vector2(worldPos.x, worldPos.y);
// Debug.Log($"[InputManager] HoldMove update at {worldPos2D}");
defaultConsumer?.OnHoldMove(worldPos2D);
// Send hold move updates to the active hold consumer
_activeHoldConsumer?.OnHoldMove(worldPos2D);
}
}
@@ -342,6 +362,12 @@ namespace Input
if (consumer == null || !_overrideConsumers.Contains(consumer))
return;
// If this is the active hold consumer, reset it
if (_activeHoldConsumer == consumer)
{
_activeHoldConsumer = null;
}
_overrideConsumers.Remove(consumer);
Debug.Log($"[InputManager] Override consumer unregistered: {consumer}");
}
@@ -351,6 +377,7 @@ namespace Input
/// </summary>
public void ClearOverrideConsumers()
{
_activeHoldConsumer = null;
_overrideConsumers.Clear();
Debug.Log("[InputManager] All override consumers cleared.");
}