lose Mom on wall and kick renetworked

This commit is contained in:
Melbyj1125
2022-02-23 13:55:30 -06:00
parent b9a573a97d
commit d9629ec555
8 changed files with 92 additions and 30 deletions

View File

@@ -7,7 +7,6 @@ public class dMoveCrouchState : dMoveBaseState
//Slide Variables
RaycastHit slideRay; // slide raycast
int layerMask;
public override void EnterState(dMoveStateManager mSM, dMoveBaseState previousState){
@@ -17,8 +16,6 @@ public class dMoveCrouchState : dMoveBaseState
mSM.moveController.height *= .5f;
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;
}
}
@@ -39,7 +36,7 @@ public class dMoveCrouchState : dMoveBaseState
//If player isn't pressing either Q or the joystick button they stop crouching if nothing is above them
if((!Input.GetKey(KeyCode.JoystickButton1) && !Input.GetKey(KeyCode.Q))){
if ((Physics.Raycast(mSM.gameObject.transform.position + new Vector3(0,1f,0), Vector3.up, out slideRay, 2f, layerMask) == false)){
if ((Physics.Raycast(mSM.gameObject.transform.position + new Vector3(0,1f,0), Vector3.up, out slideRay, 2f, mSM.layerMask) == false)){
mSM.SwitchState(mSM.IdleState);
}

View File

@@ -7,7 +7,6 @@ public class dMoveSlideState : dMoveBaseState
//Slide Variables
float originalTraction; // Traction before slide started
RaycastHit slideRay; // slide raycast
int layerMask;
public override void EnterState(dMoveStateManager mSM, dMoveBaseState previousState){
@@ -18,8 +17,6 @@ public class dMoveSlideState : dMoveBaseState
mSM.pStats.Traction = 0.01f;
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;
}
public override void ExitState(dMoveStateManager mSM, dMoveBaseState nextState){
@@ -51,7 +48,7 @@ public class dMoveSlideState : dMoveBaseState
//If player isn't pressing either Q or the joystick button they stop sliding if nothing is above them
if((!Input.GetKey(KeyCode.JoystickButton1) && !Input.GetKey(KeyCode.Q))){
if ((Physics.Raycast(mSM.gameObject.transform.position + new Vector3(0,1f,0), Vector3.up, out slideRay, 2f, layerMask) == false)){
if ((Physics.Raycast(mSM.gameObject.transform.position + new Vector3(0,1f,0), Vector3.up, out slideRay, 2f, mSM.layerMask) == false)){
//Determine which state to go into based on player speed
if(mSM.calculatedCurVel < mSM.walkLimit){