Fix Object Instantiating
This commit is contained in:
17
Assets/Scripts/Utils/RandomUtils.cs
Normal file
17
Assets/Scripts/Utils/RandomUtils.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using Enums;
|
||||
using Random = UnityEngine.Random;
|
||||
|
||||
namespace Utils {
|
||||
public static class RandomUtils {
|
||||
public static int RandomGemTypeAsInt() {
|
||||
GemType[] spawnableGems = Enum.GetValues(typeof(GemType))
|
||||
.Cast<GemType>()
|
||||
.Where(gType => gType != GemType.Bomb)
|
||||
.ToArray();
|
||||
|
||||
return Random.Range(0, spawnableGems.Length);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user