mirror of
https://github.com/Leahnaya/TheKingsRace.git
synced 2026-08-21 18:04:27 -05:00
fixed an interaction between slide and fall
This commit is contained in:
@@ -15,7 +15,8 @@ public class dMoveCrouchState : dMoveBaseState
|
||||
if(previousState != mSM.SlideState){
|
||||
mSM.pStats.CurVel = 0;
|
||||
mSM.moveController.height *= .5f;
|
||||
mSM.moveController.Move(new Vector3(0,-mSM.moveController.height * .5f,0));
|
||||
mSM.moveController.center = new Vector3(0,mSM.moveController.center.y - mSM.moveController.height * .5f,0);
|
||||
//mSM.moveController.Move(new Vector3(0,-mSM.moveController.height * .5f,0));
|
||||
layerMask = 1 << 3;
|
||||
layerMask = ~layerMask;
|
||||
}
|
||||
@@ -27,7 +28,8 @@ public class dMoveCrouchState : dMoveBaseState
|
||||
if(nextState != mSM.CrouchWalkState){
|
||||
mSM.gameObject.transform.localEulerAngles = new Vector3(0, 0, 0);
|
||||
mSM.pStats.CurVel = mSM.calculatedCurVel;
|
||||
mSM.moveController.height *= 2.0f;
|
||||
mSM.moveController.height *= 2.0f;
|
||||
mSM.moveController.center = new Vector3(0,mSM.moveController.center.y + mSM.moveController.height * .25f,0);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -49,12 +51,12 @@ public class dMoveCrouchState : dMoveBaseState
|
||||
|
||||
//Debug.DrawRay(mSM.gameObject.transform.position + new Vector3(0,1f,0), Vector3.up * 2f, Color.red);
|
||||
|
||||
/*
|
||||
|
||||
//If falling stop sliding and go to wasd states
|
||||
if(mSM.aSM.currentState == mSM.aSM.FallingState){
|
||||
mSM.SwitchState(mSM.IdleState);
|
||||
}
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
public override void FixedUpdateState(dMoveStateManager mSM){
|
||||
|
||||
@@ -16,7 +16,8 @@ public class dMoveSlideState : dMoveBaseState
|
||||
originalTraction = mSM.pStats.Traction;
|
||||
mSM.moveController.height *= .5f;
|
||||
mSM.pStats.Traction = 0.01f;
|
||||
mSM.moveController.Move(new Vector3(0,-0.1f,0));
|
||||
mSM.moveController.center = new Vector3(0,mSM.moveController.center.y - mSM.moveController.height * .5f,0);
|
||||
//mSM.moveController.Move(new Vector3(0,-0.1f,0));
|
||||
layerMask = 1 << 3;
|
||||
layerMask = ~layerMask;
|
||||
}
|
||||
@@ -29,6 +30,7 @@ public class dMoveSlideState : dMoveBaseState
|
||||
mSM.pStats.CurVel = mSM.calculatedCurVel;
|
||||
mSM.pStats.Traction = originalTraction;
|
||||
mSM.moveController.height *= 2.0f;
|
||||
mSM.moveController.center = new Vector3(0,mSM.moveController.center.y + mSM.moveController.height * .25f,0);
|
||||
}
|
||||
|
||||
//if state is crouch revert traction
|
||||
@@ -70,7 +72,6 @@ public class dMoveSlideState : dMoveBaseState
|
||||
|
||||
//Debug.DrawRay(mSM.gameObject.transform.position + new Vector3(0,1f,0), Vector3.up * 2f, Color.red);
|
||||
|
||||
/*
|
||||
//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
|
||||
@@ -84,7 +85,6 @@ public class dMoveSlideState : dMoveBaseState
|
||||
mSM.SwitchState(mSM.RunState);
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user