Hi,
I am working on enabling and disabling scripts.
i have a script called PlayerData(Short=PD) and in that script i have a few boolians called doubleJump, higherJumps and quickWalk(sorry for the bad naming) in an other script i have an method to apply these abilitys on a sertain buttun press. (also, i have two abilitys mainAbility and secondAbility)
the button press works by haveing a int and if a button is pressed it adds one to the “mainAbility” int. and here is what is going wrong, this is my method:
public void ApplyScriptsAbility()
{
switch (mainAbility)
{
case 0:
PD.doubleJump = false;
PD.higherJumps = false;
PD.quickWalk = false;
break;
case 1:
PD.doubleJump = true;
PD.higherJumps = false;
PD.quickWalk = false;
break;
case 2:
PD.doubleJump = false;
PD.higherJumps = true;
PD.quickWalk = false;
break;
case 3:
PD.doubleJump = false;
PD.higherJumps = false;
PD.quickWalk = true;
break;
}
switch (secondAbility)
{
case 0:
PD.doubleJump = false;
PD.higherJumps = false;
PD.quickWalk = false;
break;
case 1:
PD.doubleJump = true;
PD.higherJumps = false;
PD.quickWalk = false;
break;
case 2:
PD.doubleJump = false;
PD.higherJumps = true;
PD.quickWalk = false;
break;
case 3:
PD.doubleJump = false;
PD.higherJumps = false;
PD.quickWalk = true;
break;
}
Debug.Log(mainAbility);
}
here i just check for mainAbility to be a sertain number and enable/disable bools. I have no idea why but for some reason secondAbility works just fine but mainAbility does not work, am i overseeing something or is it just gliched, and of course if you know how pls leave it down below.
Thanks in advance,
Chris