GUI Button for Hero Skills with a delay time

How i can do something like that for my GUI Button with hero skills?

alt text

Here is an example of one way you can create your count-down buttons. To use:

  • Add this script to a game object
  • Select the game object in the inspector and open the ‘texs’ array.
  • Set the size to 18
  • Drag and drop the ‘Skill ready to use’ texture into slot 0.
  • Drag number textures into the other slots. The Element number matches the number that should be on the texture. For example, Element number 10 should get a texture with the number 10.
  • Hit play

#pragma strict

public var texs : Texture2D[];
private var timer = 0.0; 

function Update() {
    timer -= Time.deltaTime;
}

function OnGUI() {
    var tex : Texture2D;
	if (timer <= 0.0) {
		tex = texs[0];
	}
	else {
		tex = texs[Mathf.CeilToInt(timer)];
	}
	
	if (GUI.Button(Rect(0,0,100,50), tex) && timer <= 0.0) {
		Debug.Log("Doing a PowerUp");
		timer = texs.Length-1;
	}
}