Question by
rjs_chipmunk · Nov 10, 2017 at 10:47 AM ·
not workingif-statementsstatement
Cant get an if statement to activate even if the statement is fulfilled.
All the parameters of the statement are fulfilled but it isn't activating the next part of the method...
public void turnRotation() {
if (winLossConditionMet == false)
{
Debug.Log("Button Pressed");
switch (iTurnNumber)
{
case 1:
//Player1
if (sPlayer1Character != "Bob")
{
iCurrentPlayerNumber = 1;
sCurrentPlayerCharacter = sPlayer1Character;
iCurrentActionsRemaining = 2;
iTurnNumber++;
Debug.Log("Player1's Turn");
}
break;
I have added the debug log "button pressed" line to test where the code stops and when running it writes that line but doesn't get past the next if statement, I have checked the parameters over and over, just can't figure it out, I'm sure its something simple but I am pretty new to programming.
Any help is greatly appreciated, thanks!
Comment
if (winLossCondition$$anonymous$$et == false)
{
Debug.Log("Button Pressed");
switch (iTurnNumber)
{
case 1:
Debug.Log("1"); // <- Add this
//Player1
if (sPlayer1Character != "Bob")
{
iCurrentPlayerNumber = 1;
sCurrentPlayerCharacter = sPlayer1Character;
iCurrentActionsRemaining = 2;
iTurnNumber++;
Debug.Log("Player1's Turn");
}
break;
default: // <- Add this
Debug.Log("2"); // <- Add this
break; // <- Add this
}
}
@rjs_chipmunk Test if "1" or "2" gets printed?