Did some bugfixing and commented on everything

This commit is contained in:
Melbyj1125
2022-02-17 20:55:23 -06:00
parent e74a1c61c0
commit 820b11dd61
40 changed files with 528 additions and 250 deletions

View File

@@ -5,32 +5,37 @@ using UnityEngine;
public class NitroNitroingState : NitroBaseState
{
private float tempTimer;
private float actualMaxVel;
private float actualAcc;
private float tempTimer; // temporary timer
private float actualMaxVel; // actual max velocity
private float actualAcc; // actual acceleration
public override void EnterState(NitroStateManager nSM, NitroBaseState previousState){
actualMaxVel = nSM.pStats.MaxVel;
actualAcc = nSM.pStats.Acc;
nSM.pStats.Acc += nSM.nitroAccBoost;
nSM.pStats.MaxVel += nSM.nitroVelBoost;
actualMaxVel = nSM.pStats.MaxVel; // saves previous max velocity
actualAcc = nSM.pStats.Acc; // saves previous max acc
nSM.pStats.Acc += nSM.nitroAccBoost; // increases acceleration
nSM.pStats.MaxVel += nSM.nitroVelBoost; // increases max velocity
tempTimer = 5;
tempTimer = 5; // how long we will be sped up
}
public override void ExitState(NitroStateManager nSM, NitroBaseState nextState){
nSM.pStats.Acc = actualAcc;
nSM.pStats.MaxVel = actualMaxVel;
nSM.pStats.Acc = actualAcc; // reset acceleration
nSM.pStats.MaxVel = actualMaxVel; // reset maximum velocity
}
public override void UpdateState(NitroStateManager nSM){
//if still nitroing decrease timer
if(tempTimer > 0){
tempTimer -= .02f;
}
//otherwise cooldown
else{
nSM.SwitchState(nSM.CooldownState);
}
//if ragdolling then cooldown
if(nSM.mSM.currentState == nSM.mSM.RagdollState){
nSM.SwitchState(nSM.CooldownState);
}