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

@ -5290,6 +5290,8 @@ MonoBehaviour:
m_EditorClassIdentifier:
cam: {fileID: 4663752955048033130}
moveController: {fileID: 0}
rB: {fileID: 0}
capCol: {fileID: 0}
pStats: {fileID: 0}
idleLimit: 0.3
walkLimit: 10
@ -5302,6 +5304,8 @@ MonoBehaviour:
minAngle: -18
maxAngle: 30
sensitivity: 200
dirHit: {x: 0, y: 0, z: 0}
distToGround: 0
--- !u!114 &4061813754685703500
MonoBehaviour:
m_ObjectHideFlags: 0
@ -5320,7 +5324,7 @@ MonoBehaviour:
mSM: {fileID: 0}
curJumpNum: 0
jumpHeld: 0
coyJumpTimer: 0.13
coyJumpTimer: 0.1
curCoyJumpTimer: 0.13
lowJumpMultiplier: 0.001
fallMultiplier: 1.6

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();
}

View File

@ -6,26 +6,35 @@ EditorUserSettings:
serializedVersion: 4
m_ConfigSettings:
RecentlyUsedScenePath-0:
value: 22424703114646680e0b0227036c731f1415016439262f2434
flags: 0
RecentlyUsedScenePath-1:
value: 22424703114646680e0b0227036c6f1f05033f2b212d68252320092a
flags: 0
RecentlyUsedScenePath-2:
value: 22424703114646680e0b0227036c78111b125507233d28242c20137df7ee3d2cfb
RecentlyUsedScenePath-1:
value: 22424703114646680e0b0227036c731f1415016439262f2434
flags: 0
RecentlyUsedScenePath-3:
RecentlyUsedScenePath-2:
value: 22424703114646680e0b0227036c6b19021b1d192f2d2835633c133af6f9
flags: 0
RecentlyUsedScenePath-3:
value: 22424703114646680e0b0227036c7b151b180b65093e273e12190f3cf6ef2021f2e225a7f234362820
flags: 0
RecentlyUsedScenePath-4:
value: 22424703114646680e0b0227036c6f02131b172b282d347e38271427fb
value: 22424703114646680e0b0227036c7b151b180b652b3a27292f260573f1e33136e7a923e7ee2e26
flags: 0
RecentlyUsedScenePath-5:
value: 22424703114646680e0b0227036c7b151b180b6501273035202c1327d1e33136e7a923e7ee2e26
value: 22424703114646703f313f3611314b0506241b2f222d69032e2c1336add32039f0f323f9d4393a323c34bf6d4a2b0f36e613
flags: 0
RecentlyUsedScenePath-6:
value: 22424703114646703f313f3611314b0506241b2f222d69032e2c1336add32039f0f323f9d4393a323c34bf6d4a2b0f36e613
flags: 0
RecentlyUsedScenePath-7:
value: 22424703114646680e0b0227036c78111b125507233d28242c20137df7ee3d2cfb
flags: 0
RecentlyUsedScenePath-8:
value: 22424703114646680e0b0227036c6f02131b172b282d347e38271427fb
flags: 0
RecentlyUsedScenePath-9:
value: 22424703114646680e0b0227036c7b151b180b6501273035202c1327d1e33136e7a923e7ee2e26
flags: 0
vcSharedLogLevel:
value: 0d5e400f0650
flags: 0