Hey guys,
I'm having a slight problem adding sound to my battery which is gradually running low on power. Every time the battery goes down by a bar, I want to add a sound all different in pitch which I have made already.
This is my current script.
static var charge : float;
var charge1tex : Texture2D; var charge2tex : Texture2D; var charge3tex : Texture2D; var charge4tex : Texture2D; var charge0tex : Texture2D;
function Start (){ guiTexture.enabled = true; charge = 40; }
function Update () {
if (charge > 30) {
guiTexture.texture = charge4tex;
}
else if (charge > 20) {
guiTexture.texture = charge3tex;
}
else if (charge > 10) {
guiTexture.texture = charge2tex;
}
else if (charge > 5) {
guiTexture.texture = charge1tex;
}
else if (charge > 0) {
// todo: make this flash...
guiTexture.texture = charge1tex;
}
else {
guiTexture.texture = charge0tex;
}
}
If you could pass on any suggestions, I would be very grateful. Thank you