mirror of
https://github.com/tym1116/BH3.git
synced 2025-12-18 01:14:59 +01:00
28 lines
439 B
C#
28 lines
439 B
C#
using UnityEngine;
|
|
|
|
namespace MoleMole.MainMenu
|
|
{
|
|
public static class ConfigAtmosphereUtil
|
|
{
|
|
public static int ChooseRandomly(int[] rates)
|
|
{
|
|
int num = 0;
|
|
foreach (int num2 in rates)
|
|
{
|
|
num += num2;
|
|
}
|
|
int num3 = Random.Range(0, num);
|
|
num = 0;
|
|
for (int j = 0; j < rates.Length; j++)
|
|
{
|
|
num += rates[j];
|
|
if (num > num3)
|
|
{
|
|
return j;
|
|
}
|
|
}
|
|
return Random.Range(0, rates.Length);
|
|
}
|
|
}
|
|
}
|