How to change this code for different sized sprites in Slot game

I am currently designing a slot game and I have pretty much figured out the reel sizes, however what I am getting stuck on is how I can change this snippet of code so it resizes the reels individually instead of all of them at one time.

function UpdateIconsPerReel()
{
    for(var a = 0; a < reelInfo.Length; a++)
    {
        var extraIcons = a * iconsPerReelDifference;
        System.Array.Resize.<SlotInfo>(reelInfo[a].slotOrder, iconsPerReel + extraIcons);
        for(var i = 0; i < iconsPerReel + extraIcons; i++)
        {
            reelInfo[a].slotOrder[i] = new SlotInfo();
            var newSprite = new GameObject();
            newSprite.AddComponent.<SpriteRenderer>();
            newSprite.name = "Slot " + i.ToString();
            reelInfo[a].slotOrder[i].sprite = newSprite;
            reelInfo[a].slotOrder[i].sprite.transform.localScale = Vector3(iconSize, iconSize, 2);
            if(iconInfo.Length > 0)
            {
                var randomIcon : int;
                for(;;)
                {
                    randomIcon = Random.Range(0, iconInfo.Length - 1);
                    var dividend = parseFloat(iconInfo[randomIcon].frequency) + 1;
                    var randomValue = Random.value;
                    if(1/dividend > randomValue)
                    {
                        break;
                    }
                }
                if(!iconsSet)
                {
                    reelInfo[a].slotOrder[i].ID = randomIcon;
                }
                if(iconsSet)
                {
                    if(i < 3)
                    {
                        var row = 2 - i;
                        reelInfo[a].slotOrder[i].ID = prevFaceIcons[a * 3 + row];
                    }
                    else
                    {
                        reelInfo[a].slotOrder[i].ID = randomIcon;
                    }
                }
                reelInfo[a].slotOrder[i].sprite.GetComponent.<SpriteRenderer>().sprite = iconInfo[reelInfo[a].slotOrder[i].ID].sprite;
                reelInfo[a].slotOrder[i].size = Vector2(reelInfo[a].slotOrder[i].sprite.GetComponent.<SpriteRenderer>().bounds.extents.x * 2, reelInfo[a].slotOrder[i].sprite.GetComponent.<SpriteRenderer>().bounds.extents.y * 2);
                reelInfo[a].slotOrder[i].sprite.transform.position = Vector3(a * reelInfo[a].slotOrder[i].size.x - reelInfo[a].slotOrder[i].size.x * 2.5, reelInfo[a].reel.transform.position.y + i * reelInfo[a].slotOrder[i].size.y, 0);
            }
            newSprite.transform.parent = reelInfo[a].reel.transform;
        }
        RepositionReel(a, -reelInfo[a].slotOrder[0].size.y);
        var offset = iconsPerReel + extraIcons - 2;
        reelInfo[a].targetPosition = reelInfo[a].slotOrder[0].size.y * -offset;
    }
    prevIconCount = iconsPerReel;
}

Is there a way this can be done?

Using code tags properly Use code tags, this is very hard to read as is.

Thank you for your replay Brathnam, I have fixed the code in my original post now and added code tags I am sorry about that, I am use to hitting ctrl k on other forums and it auto adds it.

Do you mean you want to deal with 1 part of the reelInfo array at a time only?
Just take 1 part of the array (via index , maybe?), and store that in a variable. Then, adjust the parts where the reelInfo array and index are used to reflect the new variable? And of course, avoid the outermost loop. :slight_smile: ?

If you meant something else, please explain? And perhaps it would help if you could say where you’re stuck… My answer feels a little vague.

Hi methos5k,

Thank you for your reply, To clarify further where I am stuck is I have figured out the part of the code that sets up the reels and reel sizes, However being fairly new at C# still I am hitting a wall on the best way to change it so it sets up the reels indvidually size wise so I can have like mega symbols and Full Length ones. I hope that helps!