In my game I have a temperature gauge, it goes up based on time.
The idea is that to keep it down you have to pick things up. I can get it to animate going up fine, it doesn’t seem to pay attention to what I try for making it go down.
In my playerCollision I have this when the player collides with the pickup objects:
ScoreKeeper.temperatureAdjust = 5 ;
In my ScoreKeeper script I am doing this;
static var temperatureAdjust : int = 0 ;
function Update ()
{
TemperatureUpdate();
}
function TemperatureUpdate ()
{
var temperature : int = (Time.time - temperatureAdjust) ;
if ((temperature >= 111 ) (temperature <= 120))
{
guiTexture.texture = temperature12tex;
guiTexture.enabled = true ;
}
else if ((temperature >= 101 ) (temperature <= 110))
{
guiTexture.texture = temperature11tex;
}
This continues down in increments of 10, displaying smaller images that represent the temperature.
The problem is that this doesn’t seem to work that I can see.
Second, is that it’s not the most elegant solution I think to use different png files for the length of the thermometer. It would be better to scale the gui, but I havent’ done anything like that yet, and don’t know how feasible it is.
I’d settle for getting my logic to work for the above.
I also confess that I’m out of practice scripting and don’t know the proper way to get feedback in a debug so that it reports the current value of my “temperature”.
Any feedback on these issues would be appreciated.
cheers