bug fixes

This commit is contained in:
Melbyj1125
2022-04-27 00:37:38 -05:00
parent 16a02b2332
commit f83d22eab8
16 changed files with 125 additions and 44 deletions

View File

@@ -4,8 +4,14 @@ using UnityEngine;
public class dAerialFallingState : dAerialBaseState
{
bool shouldGlide;
public override void EnterState(dAerialStateManager aSM, dAerialBaseState previousState){
if(previousState == aSM.JumpingState && aSM.jumpHeld){
shouldGlide = true;
}
else{
shouldGlide = false;
}
}
public override void ExitState(dAerialStateManager aSM, dAerialBaseState nextState){
@@ -15,12 +21,15 @@ public class dAerialFallingState : dAerialBaseState
public override void UpdateState(dAerialStateManager aSM){
//if Grav Vel > 0 then jumping
if(aSM.pStats.GravVel > 0 && (aSM.mSM.currentState != aSM.mSM.SlideState && aSM.mSM.currentState != aSM.mSM.CrouchState && aSM.mSM.currentState != aSM.mSM.CrouchWalkState && aSM.mSM.currentState != aSM.mSM.RagdollState && aSM.mSM.currentState != aSM.mSM.RecoveringState)){
if((Input.GetButton("Jump") && aSM.jumpPressed) && (aSM.mSM.currentState != aSM.mSM.SlideState && aSM.mSM.currentState != aSM.mSM.CrouchState && aSM.mSM.currentState != aSM.mSM.CrouchWalkState && aSM.mSM.currentState != aSM.mSM.RagdollState && aSM.mSM.currentState != aSM.mSM.RecoveringState)){
Debug.Log("Going to Jump From Fall");
aSM.SwitchState(aSM.JumpingState);
}
//if jump has been pressed and has glider and is in a state that allows it glide
else if(Input.GetButton("Jump") && aSM.pStats.HasGlider && (aSM.mSM.currentState != aSM.mSM.SlideState && aSM.mSM.currentState != aSM.mSM.CrouchState && aSM.mSM.currentState != aSM.mSM.CrouchWalkState && aSM.mSM.currentState != aSM.mSM.RagdollState && aSM.mSM.currentState != aSM.mSM.RecoveringState) && !aSM.pStats.IsPaused){
else if((Input.GetButton("Jump") && (shouldGlide || (aSM.curJumpNum == aSM.pStats.JumpNum))) && aSM.pStats.HasGlider && (aSM.mSM.currentState != aSM.mSM.SlideState && aSM.mSM.currentState != aSM.mSM.CrouchState && aSM.mSM.currentState != aSM.mSM.CrouchWalkState && aSM.mSM.currentState != aSM.mSM.RagdollState && aSM.mSM.currentState != aSM.mSM.RecoveringState) && !aSM.pStats.IsPaused){
Debug.Log("Going to Glide From Fall");
aSM.SwitchState(aSM.GlidingState);
}