Changes to debug and state machine

This commit is contained in:
Melbyj1125
2022-03-07 12:02:37 -06:00
parent 71d7a84725
commit b9ff40688b
10 changed files with 31 additions and 22 deletions

View File

@@ -12,7 +12,7 @@ public class dMoveRagdollState : dMoveBaseState
public override void EnterState(dMoveStateManager mSM, dMoveBaseState previousState){
ragTime = mSM.pStats.RecovTime; // how long to be ragdolled
prevRot = mSM.transform.localEulerAngles; // save previous rotation
mSM.prevRot = mSM.transform.localEulerAngles; // save previous rotation
mSM.capCol.enabled = true; // enable capsule collider
mSM.moveController.enabled = false; // disable move controller
mSM.rB.isKinematic = false; // disable kinematic
@@ -24,12 +24,6 @@ public class dMoveRagdollState : dMoveBaseState
public override void ExitState(dMoveStateManager mSM, dMoveBaseState nextState){
mSM.pStats.GravVel = 80; // resets gravVel
mSM.capCol.enabled = false; // disable capsule collider
mSM.moveController.enabled = true; // enable move controller
mSM.rB.isKinematic = true; // enable kinematic
mSM.rB.detectCollisions = false; // detect collisions false
mSM.transform.localEulerAngles = prevRot; // reset player rotation
}
public override void UpdateState(dMoveStateManager mSM){

View File

@@ -7,7 +7,14 @@ public class dMoveRecoveringState : dMoveBaseState
////// ADD SOMETHING THAT CHECKS ANIMATION FINISH BEFORE GO TO IDLE
public override void EnterState(dMoveStateManager mSM, dMoveBaseState previousState){
mSM.pStats.GravVel = 80; // resets gravVel
mSM.capCol.enabled = false; // disable capsule collider
mSM.moveController.enabled = true; // enable move controller
mSM.rB.isKinematic = true; // enable kinematic
mSM.rB.detectCollisions = false; // detect collisions false
mSM.transform.localEulerAngles = mSM.prevRot; // reset player rotation
mSM.CancelMomentum(); // reset player variables
mSM.moveController.Move(new Vector3(0,2,0));
}
public override void ExitState(dMoveStateManager mSM, dMoveBaseState nextState){

View File

@@ -76,6 +76,7 @@ public class dMoveStateManager : NetworkBehaviour
//Ragdoll Variables
public Vector3 dirHit; // Direction hit
public float distToGround; // distance to ground
public Vector3 prevRot; // previous rotation before ragdolled
////
@@ -216,6 +217,7 @@ public class dMoveStateManager : NetworkBehaviour
//Raycast offset
Vector3 rayOffset = moveXZ - lastVel;
/*
//Check if wall is in direction player is moving
if (((Physics.Raycast(gameObject.transform.position + new Vector3(0,.4f,0) + rayOffset, moveXZ.normalized, out wallHitBot, .18f, layerMask) == true) || ((currentState != SlideState || currentState != CrouchState) && (Physics.Raycast(gameObject.transform.position + new Vector3(0,2.2f,0), moveXZ.normalized, out wallHitTop, .18f, layerMask) == true))) && !firstWallHit){
CancelMomentum();
@@ -228,7 +230,8 @@ public class dMoveStateManager : NetworkBehaviour
Debug.DrawRay(gameObject.transform.position + new Vector3(0,.4f,0) + (rayOffset/2), moveXZ.normalized * 1f, Color.red);
Debug.DrawRay(gameObject.transform.position + new Vector3(0,2.2f,0) + rayOffset, moveXZ.normalized * .2f, Color.red);
*/
driftVel = Vector3.Lerp(driftVel, moveXZ, pStats.CurTraction * Time.deltaTime);
if(currentState == GrappleAirState){
driftVel = Vector3.zero;