My problem is that i cant wrap my head around how make a counter that just counts but with textures. I have textures of numbers 0-9 …how can i make it count past 9 and so on …like for example for 10 it would be (one and zero).
I put the textures in an array an did this… how can I get it to count to higher numbers?
#pragma strict
var TotalPoints : int;
var CoinsTextTexture: Texture;
var fontSize : int = 20;
var zero:Texture2D;
var one:Texture2D;
var two :Texture2D;
var three:Texture2D;
var four:Texture2D ;
var five:Texture2D ;
var six:Texture2D ;
var seven:Texture2D ;
var eight:Texture2D ;
var nine:Texture2D ;
function OnGUI(){
GUI.DrawTexture(Rect(Screen.width*0.7,Screen.height*0.01,190,100), CoinsTextTexture);
if(TotalPoints == 0){
GUI.DrawTexture(Rect(Screen.width*0.9,Screen.height*0.01,100,100), zero);
}else if(TotalPoints == 1){
GUI.DrawTexture(Rect(Screen.width*0.9,Screen.height*0.01,100,100), one);
}else if(TotalPoints == 2){
GUI.DrawTexture(Rect(Screen.width*0.9,Screen.height*0.01,100,100), two);
}else if(TotalPoints == 3){
GUI.DrawTexture(Rect(Screen.width*0.9,Screen.height*0.01,100,100), three);
}else if(TotalPoints == 4){
GUI.DrawTexture(Rect(Screen.width*0.9,Screen.height*0.01,100,100), four);
}else if(TotalPoints == 5){
GUI.DrawTexture(Rect(Screen.width*0.9,Screen.height*0.01,100,100), five);
}else if(TotalPoints == 6){
GUI.DrawTexture(Rect(Screen.width*0.9,Screen.height*0.01,100,100), six);
}else if(TotalPoints == 7){
GUI.DrawTexture(Rect(Screen.width*0.9,Screen.height*0.01,100,100), seven);
}else if(TotalPoints == 8){
GUI.DrawTexture(Rect(Screen.width*0.9,Screen.height*0.01,100,100), eight);
}else if(TotalPoints == 9){
GUI.DrawTexture(Rect(Screen.width*0.9,Screen.height*0.01,100,100), nine);
}
else{
GUI.skin.label.fontSize = GUI.skin.box.fontSize = GUI.skin.button.fontSize = fontSize;
GUI.contentColor = Color.black;
GUI.Label (Rect (Screen.width*0.9,Screen.height*0.01, 100, 100), ""+TotalPoints);
}
}