Setup and play area prefab

This commit is contained in:
Max 2025-03-19 09:23:22 +01:00
parent fe61df43e7
commit af12b601fc
166 changed files with 14014 additions and 10 deletions

View file

@ -0,0 +1,31 @@
using System;
using System.Collections.Generic;
using Unity.VisualScripting;
namespace DefaultNamespace
{
public static class StackExtensions
{
private static Random random = new Random();
public static void Shuffle<T>(this Stack<T> stack)
{
List<T> list = new List<T>(stack);
stack.Clear();
// Fisher-Yates shuffle
for (int i = list.Count - 1; i > 0; i--)
{
int j = random.Next(i + 1);
(list[i], list[j]) = (list[j], list[i]); // Swap elements
}
// Push shuffled elements back to stack
foreach (T item in list)
{
stack.Push(item);
}
}
}
}