Create HeroDeck with state of cards
This commit is contained in:
parent
967c871ed9
commit
567b732f85
7 changed files with 175 additions and 17 deletions
18
Assets/ListShuffle.cs
Normal file
18
Assets/ListShuffle.cs
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public static class ListShuffle
|
||||
{
|
||||
public static void Shuffle<T>(this IList<T> list)
|
||||
{
|
||||
int n = list.Count;
|
||||
while (n > 1) {
|
||||
int k = Random.Range(0, n);
|
||||
n--;
|
||||
T value = list[k];
|
||||
list[k] = list[n];
|
||||
list[n] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue