Correct, at the basic level the code is going: "I have this variable, isLevelUnlocked, which is a bool. I need to take whatever is on the other side of the equal sign and convert it into a bool." In this case (levelValue==1) is a boolean expression. It literally checks if levelValue is 1 and returns a true or false. Since it returns a boolean already, we can just stick it into isLevelUnlocked without any conversion.3) so now it goes true a boolean operations;
bool isLevelUnlocked = (levelValue==1) this means that if my GetInt was "1", the bool isLevelUnlocked is true.
On the other hand you could also take the number and explicit convert it into a bool.
bool isLevelUnlocked = (bool)levelValue;
In this case we are explicitly casting levelValue into a bool. Think of a bool as just a number. If you cast like this then all it is doing is converting the type of it. So if you had levelValue set to 1, 3, or even 700, they are all non-zero values. When it's just sitting in the bool that doesn't mean much, however when you place the value into a boolean expression, then it suddenly means something.if(levelValue)
Will equal true if it is any number besides 0(at least that's the case in most languages.) On the other hand if you do an expression like:bool isLevelUnlocked = (levelValue==1)
you are not just interpreting a number as a bool, you are evaluating an expression that returns a bool. Usually expressions that return bools will return a 1 for true and a 0 for false.In most case it is considered bad form to convert numbers straight into bools, your method of using an expression to figure it out is actually probably a good practice. But I thought I'd explain how the behavior works in case you ever get confused from a conversion giving an answer you might not expect it to. Implicit conversions(automatic conversions) can often do confusing things.