Пример #1
0
    private void ChangeBullets()    //changes the kind of bullets the turret fires based on a percentage
    {
        int        changedBullets  = Mathf.FloorToInt(percentFloat * poolBullets.Count());
        List <int> previousIndexes = new List <int>();
        int        randomIndex;

        for (int i = changedBullets; i >= 0; i--)
        {
            do
            {
                randomIndex = UnityEngine.Random.Range(0, poolBullets.Count());
            } while (previousIndexes.Contains(randomIndex));

            poolBullets.GetAtIndex(randomIndex).GetComponent <EnemyBulletTest>().SetGrabbable(true);
            previousIndexes.Add(randomIndex);
        }
    }