Question by
KillitsGaming · Jul 08, 2021 at 09:06 AM ·
c#if-statementsint
reloading Greater Than or Equal To c#
hi, I'm trying to get the reloading to work right. I'm using ints I know it's probably something stupid I'm forgetting. when i reload and have or more then a clip left its skipping the first if statement thanks.
aMMO.amooLeft = aMMO.maxAmoo;
Debug.Log(aMMO.amooLeft);
//skipping here
if (aMMO.amooLeft <= aMMO.maxClipAmoo)// checking if has more or a full clip left
{
aMMO.maxAmoo -= aMMO.maxClipAmoo;
aMMO.currntClipAmoo = aMMO.maxClipAmoo;
Debug.Log("has ammo left");
}
else if (aMMO.maxClipAmoo < aMMO.amooLeft)// checking if has a dont full clip left
{
aMMO.currntClipAmoo = aMMO.amooLeft;
aMMO.maxAmoo = 0;
Debug.Log("not max Clip");
}
curText.text = aMMO.currntClipAmoo + " / " + aMMO.maxAmoo.ToString();
Comment