Make cards use settings

This commit is contained in:
Michal Pikulski
2025-11-12 09:24:27 +01:00
committed by Michal Pikulski
parent 4fdbbb0aa8
commit a6471ede45
15 changed files with 232 additions and 69 deletions

View File

@@ -3,6 +3,8 @@ using TMPro;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
using AppleHills.Core.Settings;
using Core;
namespace UI.CardSystem.StateMachine.States
{
@@ -16,14 +18,15 @@ namespace UI.CardSystem.StateMachine.States
[SerializeField] private GameObject progressBarContainer;
[SerializeField] private Image progressBarFill;
[SerializeField] private TextMeshProUGUI progressText;
[SerializeField] private int cardsToUpgrade = 5;
private CardContext _context;
private ICardSystemSettings _settings;
private Vector3 _originalScale;
private void Awake()
{
_context = GetComponentInParent<CardContext>();
_settings = GameManager.GetSettingsObject<ICardSystemSettings>();
}
public override void OnEnterState()
@@ -41,13 +44,14 @@ namespace UI.CardSystem.StateMachine.States
// Enlarge the card
if (_context.Animator != null)
{
_context.Animator.PlayEnlarge();
_context.Animator.PlayEnlarge(_settings.NewCardEnlargedScale);
}
}
private void UpdateProgressBar()
{
int currentCount = _context.RepeatCardCount;
int cardsToUpgrade = _settings.CardsToUpgrade;
float progress = (float)currentCount / cardsToUpgrade;
if (progressBarFill != null)