Exemple #1
0
    void CreateBalls()
    {
        if (GameMNG.Instance.TestingModeEnabled)
        {
            _allRandomBalls = new List <int>();
            TestingUtils.PrepareBallsTest(_allSRBalls, _allRandomBalls, BallSprites);
            return;
        }

        List <int> allRangeNumbers = new List <int>(Enumerable.Range(1, 60).ToArray());

        _allRandomBalls = new List <int>();

        int nextRandomIndex, nextRandom;

        for (int i = 0; i < GameMNG.Instance.NumberOfBalls; i++)
        {
            nextRandomIndex = Random.Range(0, allRangeNumbers.Count);
            nextRandom      = allRangeNumbers[nextRandomIndex];
            _allRandomBalls.Add(nextRandom);
            _allSRBalls[i].sprite = BallSprites[nextRandom - 1];
            allRangeNumbers.RemoveAt(nextRandomIndex);
        }
    }