From my first glance I would say too many parentheses. The if statements are being done to check all those conditions right? So you would keep all those conditions within the same set of parentheses for that if statement. So more like this.
The if as statement looks fine, but what do you intent to do? Tell me what is the logic or behavior you expect. When player win and when player looses?
Note that both IF are independent and that is precendente over || (evaluated first).
Note that nothing happens IF
Dealer and Player are greater then 25
Dealer and Player are equal
Dealer and Player are equal to 25
Also depends where are you running this script. If you are running any turn, the if will execute with any number less than 25.
The IF you build says that
Player Looses IF
DealerTotal is less then 25 AND
Greater then PlayerTotal OR PlayerTotal greater then 25
Player Win IF
PlayerTotal less then 25 AND
Greater then DealerTotal OR DealerTotal Greater then 25
I notice You will have many endGame calls after calling dealerHITnowtwo, dealerHITnowthree, dealerHITnowfour. I guess you should have endGame call only at the dealerHIT.
Any way include a Debug.Log (“Dealer:” + DealerTotalLogic.playerTotal + “Player:” + PlayerTotalLogic.playerTotal + “Money:” + playersTOTALmoney) before, inside and outside each if at endGame and will be much easier to get the bug.
you can’t just give us a snippet of code and ask “what is wrong”. If it isn’t a simple syntax problem then we need more. It sounds like you have som sort of logical problem.
then remove each condition in the if-statement to see if it validates or not, then add a condition, and then add the next condition… step by step debugging.
Try splitting the conditions as hpjohn said but keep the parts together as they are dependent on each other.
Also note that you can debug as Toerktumlare said.
Debug.Log(WhatYouWantToFindRightHere);
That way if the variable isn’t changing you can see what it is at least and find where the error is happening. Also make sure the variables you are using there (playersTOTALmoney and playersBETamount) actually have a value. If both return with a value, then the problem is in the conditions of your if statement. Could be wording/logic. If this is the case then focus on the conditions of that if statement.
then start removing the conditions one by one. Have first a simple condition. Then add another, and then add a third and whenever it fails. Then bob’s your uncle.