Files
AppleHillsProduction/Assets/Scripts/UI/CardSystem/StateMachine/States/CardRevealedState.cs

69 lines
2.3 KiB
C#
Raw Normal View History

2025-11-11 20:25:23 +01:00
using Core.SaveLoad;
2025-11-12 11:58:01 +01:00
using UnityEngine;
2025-11-11 20:25:23 +01:00
namespace UI.CardSystem.StateMachine.States
{
/// <summary>
/// Revealed state - card is flipped and visible at normal size.
/// This is the "waiting" state:
/// - In booster flow: waiting for all cards to finish before animating to album
/// - In album placement flow: waiting to be dragged to a slot
2025-11-12 11:58:01 +01:00
/// Shows small idle badges for NEW or REPEAT cards.
2025-11-11 20:25:23 +01:00
/// </summary>
public class CardRevealedState : AppleState
2025-11-11 20:25:23 +01:00
{
2025-11-12 11:58:01 +01:00
[Header("State-Owned Visuals")]
[SerializeField] private UnityEngine.GameObject newCardIdleBadge;
[SerializeField] private UnityEngine.GameObject repeatCardIdleBadge;
2025-11-11 20:25:23 +01:00
private CardContext _context;
private void Awake()
{
_context = GetComponentInParent<CardContext>();
}
public override void OnEnterState()
{
// Card is at normal size, fully revealed
2025-11-12 11:58:01 +01:00
// Show appropriate idle badge
if (_context.IsNewCard)
{
if (newCardIdleBadge != null)
newCardIdleBadge.SetActive(true);
if (repeatCardIdleBadge != null)
repeatCardIdleBadge.SetActive(false);
}
else if (_context.RepeatCardCount > 0)
{
if (newCardIdleBadge != null)
newCardIdleBadge.SetActive(false);
if (repeatCardIdleBadge != null)
repeatCardIdleBadge.SetActive(true);
}
else
{
// Neither new nor repeat - hide both
if (newCardIdleBadge != null)
newCardIdleBadge.SetActive(false);
if (repeatCardIdleBadge != null)
repeatCardIdleBadge.SetActive(false);
}
// Fire interaction complete event (for BoosterOpeningPage tracking)
_context.FireCardInteractionComplete();
2025-11-11 20:25:23 +01:00
}
2025-11-12 11:58:01 +01:00
private void OnDisable()
{
// Hide badges when leaving state
if (newCardIdleBadge != null)
newCardIdleBadge.SetActive(false);
if (repeatCardIdleBadge != null)
repeatCardIdleBadge.SetActive(false);
}
2025-11-11 20:25:23 +01:00
}
}