From 352a3a8de6abd7e9744f9037113cae6556bdc00d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20P=C4=9Bnkava?= Date: Tue, 29 Jul 2025 00:11:48 +0200 Subject: [PATCH] Card display --- 3D blobici/Assets/Scripts/Cards/CardManager.cs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/3D blobici/Assets/Scripts/Cards/CardManager.cs b/3D blobici/Assets/Scripts/Cards/CardManager.cs index bc20e77..7a631ee 100644 --- a/3D blobici/Assets/Scripts/Cards/CardManager.cs +++ b/3D blobici/Assets/Scripts/Cards/CardManager.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Linq; using System; +using UnityEngine.Rendering; public class CardManager : MonoBehaviour { @@ -63,16 +64,15 @@ public class CardManager : MonoBehaviour Debug.Log($"Available cards: {string.Join(", ", availableCards.Select(x => x.Skill))}"); Debug.Log($"Unlocked skills: {string.Join(", ", unlockedSkills)}"); - int xOffset = -800; - if (availableCards.Count < 3) - { - xOffset = -400; - } + float step = Screen.width / shuffled.Count; + float pos = step - Screen.width / (2*shuffled.Count); + + foreach (var cardUI in shuffled) { - var newCard = Instantiate(cardUI.gameObject, cardsParent.position + new Vector3(xOffset, 0, 0), Quaternion.identity, cardsParent); - xOffset += 800; + var newCard = Instantiate(cardUI.gameObject, new Vector3(pos, Screen.height/2, 0), Quaternion.identity, cardsParent); + pos += step; } }