Finalize nice animations

This commit is contained in:
Michal Pikulski
2025-11-17 23:49:37 +01:00
parent e18f1b9963
commit 689e177c99
5 changed files with 34 additions and 36 deletions

View File

@@ -444,23 +444,12 @@ namespace UI.CardSystem
private void OnCardShrinkRequested(StateMachine.States.CardAlbumEnlargedState state)
{
if (state == null) return;
// Hide backdrop
// Hide backdrop; state will animate back to slot and reparent on completion
if (cardEnlargedBackdrop != null)
{
cardEnlargedBackdrop.SetActive(false);
}
// Reparent back to original parent and restore local transform
var ctx = state.GetComponentInParent<StateMachine.CardContext>();
if (ctx != null)
{
Transform originalParent = state.GetOriginalParent();
if (originalParent != null)
{
ctx.RootTransform.SetParent(originalParent, true);
ctx.RootTransform.localPosition = state.GetOriginalLocalPosition();
ctx.RootTransform.localRotation = state.GetOriginalLocalRotation();
}
}
// Do not reparent here; reverse animation is orchestrated by the state
}
#endregion