I am about to explode. I have been looking for two hours for a way to fix this problem. I have a switch statement in the setTimer method. When i debug the program, the timerType value changes while the method is in action, but as soon as it exits, timerType reverts back to null. This makes my case statement kind of useless as I need it to change for the next time I call the method. I would love your helping hand as I am sure it is something simple as usual :( . I tried changing it to an int to see if it was something to do with the String type or whatever. Im a bit of a noob. Please stop me from floundering any longer (at least on this particular problem :) )
public string timerType;
if (checkRoundChanged()) {
SoundPlayer.Play();
setTimer(timerType);
}
and the method
protected void setTimer(String timerType){
switch (timerType) {
case "ready":
secLeft = readySec;
minLeft = readyMin;
timerType = "round";
break;
case "round":
secLeft = roundSec;
minLeft = roundMin;
timerType = "rest";
break;
case "rest":
secLeft = restSec;
minLeft = restMin;
timerType = "round";
break;
case "relax":
secLeft = relaxSec;
minLeft = relaxMin;
timerType = "done";
break;
default:
timerType = "ready";
break;
}
}
Thankyou!