Files
AppleHillsProduction/Assets/Scripts/UI/CardSystem/StateMachine/States/CardPlacedInSlotState.cs
2025-11-15 20:37:01 +01:00

54 lines
1.5 KiB
C#

using Core;
using Core.SaveLoad;
using UnityEngine.EventSystems;
namespace UI.CardSystem.StateMachine.States
{
/// <summary>
/// Placed in slot state - card is in an album slot and can be clicked to enlarge.
/// Manages the parent slot reference.
/// </summary>
public class CardPlacedInSlotState : AppleState, IPointerClickHandler
{
private CardContext _context;
private AlbumCardSlot _parentSlot;
private void Awake()
{
_context = GetComponentInParent<CardContext>();
}
public override void OnEnterState()
{
Logging.Debug($"[CardPlacedInSlotState] Card placed in slot: {_context.CardData?.Name}");
// Card is now part of the album, no special visuals needed
// Just wait for interaction
}
/// <summary>
/// Set the parent slot this card belongs to
/// </summary>
public void SetParentSlot(AlbumCardSlot slot)
{
_parentSlot = slot;
}
/// <summary>
/// Get the parent slot
/// </summary>
public AlbumCardSlot GetParentSlot()
{
return _parentSlot;
}
public void OnPointerClick(PointerEventData eventData)
{
// Click to enlarge when in album
Logging.Debug($"[CardPlacedInSlotState] Card clicked in slot, transitioning to enlarged state");
_context.StateMachine.ChangeState("AlbumEnlargedState");
}
}
}