mirror of
https://github.com/Leahnaya/TheKingsRace.git
synced 2026-08-22 18:34:32 -05:00
added slide check functionality for certain functions
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -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>();
|
||||
////
|
||||
}
|
||||
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
@@ -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){
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user