Add backbone for card creation and implement Camera minigame mechanics

This commit is contained in:
Michal Pikulski
2025-10-10 14:31:51 +02:00
parent d9039ce655
commit 0c5546efd2
107 changed files with 10490 additions and 280 deletions

View File

@@ -0,0 +1,39 @@
using UnityEngine;
namespace UI.Utils
{
[ExecuteAlways] // ✅ Runs in Edit Mode too
[RequireComponent(typeof(RectTransform))]
public class MaxHeightScaler : MonoBehaviour
{
public float maxHeight = 400f;
public bool maintainAspectInEditor = true;
private RectTransform rect;
void Awake()
{
rect = GetComponent<RectTransform>();
}
void Update()
{
if (rect == null) return;
// Get current screen or parent height
float availableHeight = Screen.height;
float targetHeight = Mathf.Min(availableHeight, maxHeight);
#if UNITY_EDITOR
// In Editor Mode, use parent height so UI previews nicely in Canvas
if (!Application.isPlaying && rect.parent is RectTransform parent)
{
float parentHeight = parent.rect.height;
targetHeight = Mathf.Min(parentHeight, maxHeight);
}
#endif
rect.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, targetHeight);
}
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 9d2badd0f003c954487f5783c481102a