Make cards use settings
This commit is contained in:
committed by
Michal Pikulski
parent
4fdbbb0aa8
commit
a6471ede45
@@ -2,6 +2,8 @@
|
||||
using Pixelplacement.TweenSystem;
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
using AppleHills.Core.Settings;
|
||||
using Core;
|
||||
|
||||
namespace UI.CardSystem.StateMachine.States
|
||||
{
|
||||
@@ -17,17 +19,16 @@ namespace UI.CardSystem.StateMachine.States
|
||||
|
||||
[Header("Idle Hover Settings")]
|
||||
[SerializeField] private bool enableIdleHover = true;
|
||||
[SerializeField] private float idleHoverHeight = 10f;
|
||||
[SerializeField] private float idleHoverDuration = 1.5f;
|
||||
[SerializeField] private float hoverScaleMultiplier = 1.05f;
|
||||
|
||||
private CardContext _context;
|
||||
private ICardSystemSettings _settings;
|
||||
private TweenBase _idleHoverTween;
|
||||
private Vector2 _originalPosition;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
_context = GetComponentInParent<CardContext>();
|
||||
_settings = GameManager.GetSettingsObject<ICardSystemSettings>();
|
||||
}
|
||||
|
||||
public override void OnEnterState()
|
||||
@@ -57,7 +58,7 @@ namespace UI.CardSystem.StateMachine.States
|
||||
// Start idle hover animation
|
||||
if (enableIdleHover && _context.Animator != null)
|
||||
{
|
||||
_idleHoverTween = _context.Animator.StartIdleHover(idleHoverHeight, idleHoverDuration);
|
||||
_idleHoverTween = _context.Animator.StartIdleHover(_settings.IdleHoverHeight, _settings.IdleHoverDuration);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,7 +67,7 @@ namespace UI.CardSystem.StateMachine.States
|
||||
// Scale up slightly on hover
|
||||
if (_context.Animator != null)
|
||||
{
|
||||
_context.Animator.AnimateScale(Vector3.one * hoverScaleMultiplier, 0.2f);
|
||||
_context.Animator.AnimateScale(Vector3.one * _settings.HoverScaleMultiplier, 0.2f);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user