So when i start this, the code stays in the first if statement, even though i recognises the change of the boolean values. What am i doing wrong?
public class TrainingManager : MonoBehaviour
{
public static float waitTimer = 2.0f;
private bool s_01_beginSequence = false;
private bool s_02_visualiseBtn = false;
private float waitBeforeStim = 1.00f; //Wait timers (amount of time)
private float waitBeforeRestart = 2.00f;
private float waitBeforeStimActual = 0.0f; //Wait timers (initial start time)
private float stimulate = 0.0f;
private float showButtonClr = 0.0f;
private float restart = 0.0f;
void Update ()
{
if ( s_01_beginSequence == true && s_02_visualiseBtn == false)
{
// wait until it is 1.0
if (waitBeforeStimActual < waitBeforeStim)
{
waitBeforeStimActual += Time.deltaTime;
}
if (waitBeforeStimActual > waitBeforeStim)
{
if (stimulate >= waitTimer)
{
stimSound.Stop ();
s_02_visualiseBtn = true;
s_01_beginSequence = false;
}
else if (stimulate < waitTimer)
{
stimulate += Time.deltaTime;
if (!stimSound.isPlaying)
{
stimSound.Play ();
}
}
}
}
else if ( s_01_beginSequence == false && s_02_visualiseBtn == true )
{
if (waitBeforeStimActual > waitBeforeStim)
{
if (showButtonClr >= waitTimer)
{
stimSound.Stop ();
s_02_visualiseBtn = false;
s_01_beginSequence = true;
stimulate = 0.0f;
showButtonClr = 0.0f;
}
else if (stimulate < waitTimer)
{
showButtonClr += Time.deltaTime;
if (!stimSound.isPlaying)
{
stimSound.Play ();
}
}
}
}
if ( Input.getKeyDown ("space") )
{
s_01_beginSequence = true;
}
it should be note that the s_01_beginSequence bool becomes true from another script
– Funkeeh[83518-error.png|83518] Thank you for your reply. I received this error. Which ponits to the line: SceneManager.LoadScene (nextScene.name);
– Damo1175