added slide check functionality for certain functions

This commit is contained in:
Melbyj1125
2022-02-14 12:55:36 -06:00
parent e1cf0bb094
commit fc525861d4
8 changed files with 70 additions and 13 deletions

View File

@@ -12,7 +12,7 @@ public class AerialFallingState : AerialBaseState
if(aSM.pStats.GravVel > 0){
aSM.SwitchState(aSM.JumpingState);
}
else if(Input.GetButton("Jump") && aSM.pStats.HasGlider){
else if(Input.GetButton("Jump") && aSM.pStats.HasGlider && (aSM.mSM.currentState != aSM.mSM.SlideState && aSM.mSM.currentState != aSM.mSM.RagdollState && aSM.mSM.currentState != aSM.mSM.RecoveringState)){
aSM.SwitchState(aSM.GlidingState);
}

View File

@@ -5,7 +5,7 @@ using UnityEngine;
public class AerialStateManager : MonoBehaviour
{
////Player States
AerialBaseState currentState;
public AerialBaseState currentState;
public AerialBaseState previousState;
//Aerial States
@@ -91,7 +91,6 @@ public class AerialStateManager : MonoBehaviour
DownwardMovement();
}
else{
Debug.Log(currentState);
//Gravity without moveController
pStats.GravVel -= pStats.PlayerGrav * Time.deltaTime;
rB.AddForce(new Vector3(0,pStats.GravVel,0));

View File

@@ -5,7 +5,7 @@ using UnityEngine;
public class MoveStateManager : MonoBehaviour
{
////Player States
MoveBaseState currentState;
public MoveBaseState currentState;
public MoveBaseState previousState;
//WASD States
@@ -38,6 +38,7 @@ public class MoveStateManager : MonoBehaviour
////Scripts Section
public PlayerStats pStats; // Player Stats
public AerialStateManager aSM;
////
////State Transition Variables
@@ -90,6 +91,7 @@ public class MoveStateManager : MonoBehaviour
////Initialize Scripts
pStats = GetComponent<PlayerStats>(); // set PlayerStats
aSM = GetComponent<AerialStateManager>();
////
}

View File

@@ -43,6 +43,13 @@ public class MoveCrouchState : MoveBaseState
}
}
/*
//If falling stop sliding and go to wasd states
if(mSM.aSM.currentState == mSM.aSM.FallingState){
ExitCrouchState(mSM);
mSM.SwitchState(mSM.IdleState);
}
*/
mSM.SlideMovement();
}

View File

@@ -14,6 +14,23 @@ public class MoveCrouchWalkState : MoveBaseState
public override void FixedUpdateState(MoveStateManager mSM){
/*
if(mSM.aSM.currentState == mSM.aSM.FallingState){
//Determine which state to go into based on player speed
if(mSM.calculatedCurVel < mSM.walkLimit){
SlideToMoveState(mSM);
mSM.SwitchState(mSM.WalkState);
}
else if(mSM.calculatedCurVel < mSM.runLimit){
SlideToMoveState(mSM);
mSM.SwitchState(mSM.JogState);
}
else{
SlideToMoveState(mSM);
mSM.SwitchState(mSM.RunState);
}
}
*/
}
public override void OnCollisionEnter(MoveStateManager mSM){

View File

@@ -53,8 +53,27 @@ public class MoveSlideState : MoveBaseState
else{
Debug.Log("Object above you");
}
}
/*
//If falling stop sliding and go to wasd states
if(mSM.aSM.currentState == mSM.aSM.FallingState){
//Determine which state to go into based on player speed
if(mSM.calculatedCurVel < mSM.walkLimit){
SlideToMoveState(mSM);
mSM.SwitchState(mSM.WalkState);
}
else if(mSM.calculatedCurVel < mSM.runLimit){
SlideToMoveState(mSM);
mSM.SwitchState(mSM.JogState);
}
else{
SlideToMoveState(mSM);
mSM.SwitchState(mSM.RunState);
}
}
*/
mSM.SlideMovement();
}