Displaying/getting elements of a list in a certain order

I have some powerups for my game that I have stored in a list.

Each powerup lasts for a certain duration.

When a powerup is received, it is added to the list as below:

 `bonusQueue.Add(BonusType.SLOWMO);`

 `bonusQueue.Add(BonusType.BOUNCY);`

etc…

Likewise when the timer for each powerup is finished, I remove the powerup from the list like so:

 `bonusQueue.Remove (BonusType.SLOWMO);`

At most there can be 5 powerups in the list and it changes dynamically accordingly.

The powerups all work as I want but I am having trouble with the icons I want to display for the powerups.

I want to display all powerups stacked according to the order they were received like the picture below:

[28093-icons.jpg*_|28093]

So as a powerup is added to the list, it should go to the start of the list.
As such the icons will work by icon 1 will display whatever is at list element 1, icon 2 will display list element 2, etc…

If there are no elements present at a certain index, it will display no icon.

I have some code and comments in psuedocode

public GameObject powerupIcon1;
public GameObject powerupIcon2;
public GameObject powerupIcon3;

public void ChangeIcons()
{
	for(int i = 0; i < internalManager.bonusQueue.Count+1; i++)
    {
            if(internalManager.GetBonus(i) == InternalBonusManager.BonusType.NULL) 
            break;
	     Debug.Log (System.Enum.GetNames(typeof(InternalBonusManager.BonusType))*);*

//get the name of the powerup at position
//if the name at [1] == “SLOWMO”, powerupIcon1.Sprite.name == “SlowMo”;
//if the name at [1] == “BOUNCY”, powerupIcon1.Sprite.name == “Bouncy”;
//if the name at [2] == “SLOWMO”, powerupIcon2.Sprite.name == “SlowMo”;
//and so on until number 5
* }*
}
public BonusType GetBonus(int index) {
* if(bonusQueue.Count == 0) return BonusType.NULL;*
* if(index >= bonusQueue.Count) return BonusType.NULL;*
* return bonusQueue[index];*

My main problem I think is not fully understanding how to properly work a list and how to iterate through it to find a certain value.
I may be wrong in assuming that when a new element is added to the list, it goes to the front and that when an element is removed, the other all shift down in position.
Any help or ideas for how to achieve this greatly appreciated.
_*

When you Add() to the list, the added element goes to the last index.
If you want to add it in front, use Insert().

[msdn List methods][1] - Add method states where items are added. In this case, at the end of it.
If you reorganize your list items by time, then you need to sort that list, or use some sorted collection.

My take on it:

using UnityEngine;
using System.Collections;

[System.Serializable]
public class PowerUp
{

	public enum EBonusType
	{
		Null,
		Slow,
		Fast,
	}

	public float myTime;
	public EBonusType bonusType;
	
	public PowerUp(){}

	public PowerUp(EBonusType powerType, float seconds)
	{
		bonusType = powerType;
		myTime = seconds;
	}

	public bool TickTime()
	{
		myTime -= Time.deltaTime;
		return (myTime <= 0f ) ? true : false ;

	}
}

And the manager:

using UnityEngine;
using System.Collections;
using System.Collections.Generic;

[System.Serializable]
public class PowerUpManager : MonoBehaviour
{
	public bool boolem;
	public List<PowerUp> powerUps = new List<PowerUp>();
	
	void ListTick()
	{
		for(int i = 0 ; i < powerUps.Count ; i++)
		{
			if(powerUps*.TickTime())*
  •  	{*
    
  •  		powerUps.RemoveAt(i);*
    
  •  	}*
    
  •  	if( i-1 < 0 ) continue;*
    

_ if(powerUps*.myTime < powerUps[i-1].myTime)_
_
{_
_
PowerUp tempPowerUp = powerUps[i-1];_
_ powerUps[i-1] = powerUps;
powerUps = tempPowerUp;
}
}
}*_

* void Update(){*
* if(boolem){*
* int range = Random.Range(1,3);*
_ float seconds = Random.value 15f;
powerUps.Add(new PowerUp( (PowerUp.EBonusType)range, seconds ) );
boolem = false;
}
ListTick();
}
}
[1]: Microsoft Learn: Build skills that open doors in your career

I managed to get it going using a switch case and looping through the list getting each element and assigning that element to the icon:

public class BonusManager : MonoBehaviour {

    public UILabel[] powerupLabel;			//Our Powerup text label
    public GameObject[] powerupIcon;		//Our Powerup Icon
    public InternalBonusManager internalManager = new InternalBonusManager();

public void ChangeIcons()
	{
		// update the interface for the (up to) three other weapons
		
		for(int i = 0; i <= internalManager.bonusQueue.Count; ++i) 
		{
			if(internalManager.GetBonus(i) == InternalBonusManager.BonusType.NULL)
			{
				powerupIcon*.GetComponent<UISprite>().spriteName = "Empty";*
  •  	}*
    
  •  	switch(internalManager.GetBonus(i))*
    
  •  	{*
    
  •  	case InternalBonusManager.BonusType.BOUNCY:*
    

_ powerupLabel*.text = internalManager.BouncyDuration.ToString(“##”);_
_ powerupIcon.GetComponent().spriteName = “Bouncy”;
break;*_

* case InternalBonusManager.BonusType.SLOWMO:*
_ powerupLabel*.text = internalManager.SlowMoDuration.ToString(“##”);
powerupIcon.GetComponent().spriteName = “SlowMo”;
break;*_

* case InternalBonusManager.BonusType.STRAIGHT:*
_ powerupLabel*.text = internalManager.StraightShooterDuration.ToString(“##”);
powerupIcon.GetComponent().spriteName = “StraightShooter”;
break;
}
}*_

* }*
}
public class InternalBonusManager {

* public float BouncyDuration { get; set; } // rapid’s duration*
* public float StraightShooterDuration { get; set; } // rapid’s duration*
* public float SlowMoDuration { get; set; } // rapid’s duration*

* // the list of weapons*
* public enum BonusType {*
* NULL, BOUNCY, STRAIGHT, SLOWMO*
* }*

public List bonusQueue = new List();
public BonusType GetBonus(int index) {
* if(bonusQueue.Count == 0) return BonusType.NULL;*
* if(index >= bonusQueue.Count) return BonusType.NULL;*
* return bonusQueue[index];*
* }*
}