I was understanding till we got to the part on vid 48 [Complete C# Unity Game Developer 3D].
When we got to the bool isTransitioning = false;
and then put it in the void StartSuccessSequence()
and void StartCrashSequence()
as isTransitioning = true
and then put an if statement up in void OnCollisionEnter(Collision other)
as if (isTransitioning) { return; }
So we marked StartCrashSequence and StartSuccessSequence as true in the switch code. The if statement is where I actually get confused on.
So in the if statement it’s saying if isTransitioning is true then return but they are already true in the crash and sucessSequence. So yeah I’m confused haha.
void OnCollisionEnter(Collision other)
{
if (isTransitioning) { return; } switch (other.gameObject.tag) { case "Friendly": break; case "Finish": StartSuccessSequence(); break; default: StartCrashSequence(); break; } }