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,32 @@
using UnityEngine;
namespace Utils
{
public class QuickAccess : MonoBehaviour
{
private static QuickAccess _instance;
private static bool _isQuitting = false;
public static QuickAccess Instance
{
get
{
if (_instance == null && Application.isPlaying && !_isQuitting)
{
_instance = FindAnyObjectByType<QuickAccess>();
if (_instance == null)
{
var go = new GameObject("QuickAccess");
_instance = go.AddComponent<QuickAccess>();
}
}
return _instance;
}
}
void OnApplicationQuit()
{
_isQuitting = true;
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: e276089fbc344b3d8cb14729dbe3508a
timeCreated: 1760095787

View File

@@ -0,0 +1,55 @@
using UnityEngine;
namespace AppleHills.Utilities
{
/// <summary>
/// Collection of useful extension methods for Unity built-in classes
/// </summary>
public static class UnityExtensions
{
/// <summary>
/// Extension method to check if a layer is in a layermask.
/// Accounts for Unity's 0-indexed layer system when comparing with editor layer values.
/// </summary>
/// <param name="mask">The layer mask to check</param>
/// <param name="layer">The layer value to check for</param>
/// <returns>True if the layer is in the mask, false otherwise</returns>
public static bool Contains(this LayerMask mask, int layer)
{
// Adjust for the -1 offset as specifically requested
int adjustedLayer = layer - 1;
return mask.value == (mask.value | (1 << adjustedLayer));
}
/// <summary>
/// Extension method to check if a GameObject's layer is in a layermask.
/// Automatically gets the layer from the GameObject and handles the offset.
/// </summary>
/// <param name="mask">The layer mask to check</param>
/// <param name="gameObject">The GameObject whose layer to check</param>
/// <returns>True if the GameObject's layer is in the mask, false otherwise</returns>
public static bool Contains(this LayerMask mask, GameObject gameObject)
{
if (gameObject == null) return false;
int layer = gameObject.layer;
// Adjust for the -1 offset as specifically requested
int adjustedLayer = layer - 1;
return mask.value == (mask.value | (1 << adjustedLayer));
}
/// <summary>
/// Bitwise check if a layer is in a layermask.
/// This is an alternative implementation that uses bitwise AND operation.
/// </summary>
/// <param name="mask">The layer mask to check</param>
/// <param name="layer">The layer value to check for</param>
/// <returns>True if the layer is in the mask, false otherwise</returns>
public static bool ContainsBitwise(this LayerMask mask, int layer)
{
// Adjust for the -1 offset as specifically requested
int adjustedLayer = layer - 1;
return (mask.value & (1 << adjustedLayer)) != 0;
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 3e92a12c248d4b9ab06fcc0ba9c63ef3
timeCreated: 1758717247