Fixed Grapple Momentum & Added swappable buttons

This commit is contained in:
Melbyj1125 2022-04-25 14:18:41 -05:00
parent 41a7908cd0
commit e072f3e181
17 changed files with 19 additions and 26 deletions

View File

@ -22,7 +22,7 @@ public class dMoveIdleState : dMoveBaseState
}
//If Q or joystick button1 crouch state
else if((Input.GetKey(KeyCode.JoystickButton1) || Input.GetKey(KeyCode.Q)) && (mSM.aSM.currentState != mSM.aSM.FallingState && mSM.aSM.currentState != mSM.aSM.GlidingState && mSM.aSM.currentState != mSM.aSM.WallRunState && mSM.aSM.currentState != mSM.aSM.WallIdleState) && !mSM.pStats.IsPaused){
else if((Input.GetKey(KeyCode.JoystickButton1) || Input.GetKey(KeyCode.Q)) && (mSM.aSM.currentState != mSM.aSM.GrappleAirState && mSM.aSM.currentState != mSM.aSM.FallingState && mSM.aSM.currentState != mSM.aSM.GlidingState && mSM.aSM.currentState != mSM.aSM.WallRunState && mSM.aSM.currentState != mSM.aSM.WallIdleState) && !mSM.pStats.IsPaused){
mSM.SwitchState(mSM.CrouchState);
}
}

View File

@ -26,7 +26,7 @@ public class dMoveJogState : dMoveBaseState
}
//move to slide if Q or JoystickButton1
else if((Input.GetKey(KeyCode.JoystickButton1) || Input.GetKey(KeyCode.Q)) && (mSM.aSM.currentState != mSM.aSM.FallingState && mSM.aSM.currentState != mSM.aSM.GlidingState && mSM.aSM.currentState != mSM.aSM.WallRunState && mSM.aSM.currentState != mSM.aSM.WallIdleState) && !mSM.pStats.IsPaused){
else if((Input.GetKey(KeyCode.JoystickButton1) || Input.GetKey(KeyCode.Q)) && (mSM.aSM.currentState != mSM.aSM.GrappleAirState && mSM.aSM.currentState != mSM.aSM.FallingState && mSM.aSM.currentState != mSM.aSM.GlidingState && mSM.aSM.currentState != mSM.aSM.WallRunState && mSM.aSM.currentState != mSM.aSM.WallIdleState) && !mSM.pStats.IsPaused){
mSM.SwitchState(mSM.SlideState);
}
}

View File

@ -22,7 +22,7 @@ public class dMoveRunState : dMoveBaseState
}
//move to slide if Q or JoystickButton1
else if((Input.GetKey(KeyCode.JoystickButton1) || Input.GetKey(KeyCode.Q)) && (mSM.aSM.currentState != mSM.aSM.FallingState && mSM.aSM.currentState != mSM.aSM.GlidingState && mSM.aSM.currentState != mSM.aSM.WallRunState && mSM.aSM.currentState != mSM.aSM.WallIdleState) && !mSM.pStats.IsPaused){
else if((Input.GetKey(KeyCode.JoystickButton1) || Input.GetKey(KeyCode.Q)) && (mSM.aSM.currentState != mSM.aSM.GrappleAirState && mSM.aSM.currentState != mSM.aSM.FallingState && mSM.aSM.currentState != mSM.aSM.GlidingState && mSM.aSM.currentState != mSM.aSM.WallRunState && mSM.aSM.currentState != mSM.aSM.WallIdleState) && !mSM.pStats.IsPaused){
mSM.SwitchState(mSM.SlideState);
}
}

View File

@ -29,7 +29,7 @@ public class dMoveWalkState : dMoveBaseState
}
//move to slide if Q or JoystickButton1
else if((Input.GetKey(KeyCode.JoystickButton1) || Input.GetKey(KeyCode.Q)) && (mSM.aSM.currentState != mSM.aSM.FallingState && mSM.aSM.currentState != mSM.aSM.GlidingState && mSM.aSM.currentState != mSM.aSM.WallRunState && mSM.aSM.currentState != mSM.aSM.WallIdleState) && !mSM.pStats.IsPaused){
else if((Input.GetKey(KeyCode.JoystickButton1) || Input.GetKey(KeyCode.Q)) && (mSM.aSM.currentState != mSM.aSM.GrappleAirState && mSM.aSM.currentState != mSM.aSM.FallingState && mSM.aSM.currentState != mSM.aSM.GlidingState && mSM.aSM.currentState != mSM.aSM.WallRunState && mSM.aSM.currentState != mSM.aSM.WallIdleState) && !mSM.pStats.IsPaused){
mSM.SwitchState(mSM.SlideState);
}
}

View File

@ -134,13 +134,6 @@ public class dMoveStateManager : NetworkBehaviour
//calculates vel using driftVel will need to be relocated
calculatedCurVel = driftVel.magnitude * 50f;
//if grappling in aerial state manager swap to grapple here
if(currentState != GrappleAirState){
if(aSM.currentState == aSM.GrappleAirState && (currentState != SlideState && currentState != CrouchState && currentState != CrouchWalkState && currentState != RagdollState && currentState != RecoveringState)){
SwitchState(GrappleAirState);
}
}
//calls any logic in the update state from current state
currentState.UpdateState(this);
}

View File

@ -590,7 +590,7 @@ public class AerialStateManager : NetworkBehaviour
////Grapple Functions
public bool CheckGrapple(){
if(!pStats.IsPaused){
if ((Input.GetKeyDown(KeyCode.E) || Input.GetKeyDown(KeyCode.JoystickButton2)) && pStats.HasGrapple) //If grapple button is hit
if ((Input.GetKeyDown(GameManager.GM.bindableActions["grappleKey"]) || Input.GetKeyDown(KeyCode.JoystickButton2)) && pStats.HasGrapple) //If grapple button is hit
{
//Debug.Log("Checking Hooks");
hookPointIndex = FindHookPoint(); //Find the nearest hook point within max distance

View File

@ -23,7 +23,7 @@ public class DashNoneState : DashBaseState
}
//if R key then Dashing
else if ((Input.GetKeyDown(KeyCode.R) || Input.GetAxis("Dash") != 0) && !dSM.pStats.IsPaused){
else if ((Input.GetKeyDown(GameManager.GM.bindableActions["dashKey"]) || Input.GetAxis("Dash") != 0) && !dSM.pStats.IsPaused){
dSM.SwitchState(dSM.DashingState);
}

View File

@ -34,7 +34,7 @@ public class MoveCrouchState : MoveBaseState
public override void UpdateState(MoveStateManager mSM){
//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((!Input.GetKey(KeyCode.JoystickButton1) && !Input.GetKeyDown(GameManager.GM.bindableActions["slideKey"]))){
if ((Physics.Raycast(mSM.gameObject.transform.position + new Vector3(0,1f,0), Vector3.up, out slideRay, 2f, mSM.layerMask) == false)){

View File

@ -19,7 +19,7 @@ public class MoveCrouchWalkState : MoveBaseState
}
public override void UpdateState(MoveStateManager mSM){
if((!Input.GetKey(KeyCode.JoystickButton1) && !Input.GetKey(KeyCode.Q))){
if((!Input.GetKey(KeyCode.JoystickButton1) && !Input.GetKeyDown(GameManager.GM.bindableActions["slideKey"]))){
mSM.SwitchState(mSM.CrouchState);
}
else if((Input.GetAxis("Vertical") == 0.0f && Input.GetAxis("Horizontal") == 0.0f)){

View File

@ -47,7 +47,7 @@ public class MoveSlideState : MoveBaseState
mSM.pStats.CurTraction += .004f;
//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((!Input.GetKey(KeyCode.JoystickButton1) && !Input.GetKeyDown(GameManager.GM.bindableActions["slideKey"]))){
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

View File

@ -22,7 +22,7 @@ public class MoveIdleState : MoveBaseState
}
//If Q or joystick button1 crouch state
else if((Input.GetKey(KeyCode.JoystickButton1) || Input.GetKey(KeyCode.Q)) && (mSM.aSM.currentState != mSM.aSM.FallingState && mSM.aSM.currentState != mSM.aSM.GlidingState && mSM.aSM.currentState != mSM.aSM.WallRunState && mSM.aSM.currentState != mSM.aSM.WallIdleState) && !mSM.pStats.IsPaused){
else if((Input.GetKey(KeyCode.JoystickButton1) || Input.GetKeyDown(GameManager.GM.bindableActions["slideKey"])) && (mSM.aSM.currentState != mSM.aSM.FallingState && mSM.aSM.currentState != mSM.aSM.GlidingState && mSM.aSM.currentState != mSM.aSM.WallRunState && mSM.aSM.currentState != mSM.aSM.WallIdleState) && !mSM.pStats.IsPaused){
mSM.SwitchState(mSM.CrouchState);
}
}

View File

@ -26,7 +26,7 @@ public class MoveJogState : MoveBaseState
}
//move to slide if Q or JoystickButton1
else if((Input.GetKey(KeyCode.JoystickButton1) || Input.GetKey(KeyCode.Q)) && (mSM.aSM.currentState != mSM.aSM.FallingState && mSM.aSM.currentState != mSM.aSM.GlidingState && mSM.aSM.currentState != mSM.aSM.WallRunState && mSM.aSM.currentState != mSM.aSM.WallIdleState) && !mSM.pStats.IsPaused){
else if((Input.GetKey(KeyCode.JoystickButton1) || Input.GetKeyDown(GameManager.GM.bindableActions["slideKey"])) && (mSM.aSM.currentState != mSM.aSM.FallingState && mSM.aSM.currentState != mSM.aSM.GlidingState && mSM.aSM.currentState != mSM.aSM.WallRunState && mSM.aSM.currentState != mSM.aSM.WallIdleState) && !mSM.pStats.IsPaused){
mSM.SwitchState(mSM.SlideState);
}
}

View File

@ -22,7 +22,7 @@ public class MoveRunState : MoveBaseState
}
//move to slide if Q or JoystickButton1
else if((Input.GetKey(KeyCode.JoystickButton1) || Input.GetKey(KeyCode.Q)) && (mSM.aSM.currentState != mSM.aSM.FallingState && mSM.aSM.currentState != mSM.aSM.GlidingState && mSM.aSM.currentState != mSM.aSM.WallRunState && mSM.aSM.currentState != mSM.aSM.WallIdleState) && !mSM.pStats.IsPaused){
else if((Input.GetKey(KeyCode.JoystickButton1) || Input.GetKeyDown(GameManager.GM.bindableActions["slideKey"])) && (mSM.aSM.currentState != mSM.aSM.FallingState && mSM.aSM.currentState != mSM.aSM.GlidingState && mSM.aSM.currentState != mSM.aSM.WallRunState && mSM.aSM.currentState != mSM.aSM.WallIdleState) && !mSM.pStats.IsPaused){
mSM.SwitchState(mSM.SlideState);
}
}

View File

@ -26,7 +26,7 @@ public class MoveWalkState : MoveBaseState
}
//move to slide if Q or JoystickButton1
else if((Input.GetKey(KeyCode.JoystickButton1) || Input.GetKey(KeyCode.Q)) && (mSM.aSM.currentState != mSM.aSM.FallingState && mSM.aSM.currentState != mSM.aSM.GlidingState && mSM.aSM.currentState != mSM.aSM.WallRunState && mSM.aSM.currentState != mSM.aSM.WallIdleState) && !mSM.pStats.IsPaused){
else if((Input.GetKey(KeyCode.JoystickButton1) || Input.GetKeyDown(GameManager.GM.bindableActions["slideKey"])) && (mSM.aSM.currentState != mSM.aSM.FallingState && mSM.aSM.currentState != mSM.aSM.GlidingState && mSM.aSM.currentState != mSM.aSM.WallRunState && mSM.aSM.currentState != mSM.aSM.WallIdleState) && !mSM.pStats.IsPaused){
mSM.SwitchState(mSM.SlideState);
}
}

View File

@ -23,7 +23,7 @@ public class NitroNoneState : NitroBaseState
}
//if pressing left shift then nitroing
else if ((Input.GetKeyDown(KeyCode.LeftShift) || Input.GetKeyDown(KeyCode.JoystickButton8)) && !nSM.pStats.IsPaused)
else if ((Input.GetKeyDown(GameManager.GM.bindableActions["nitroKey"]) || Input.GetKeyDown(KeyCode.JoystickButton8)) && !nSM.pStats.IsPaused)
{
nSM.SwitchState(nSM.NitroingState);
}

View File

@ -20,7 +20,7 @@ public class OffenseNoneState : OffenseBaseState
}
//if grounded then grounded kick states
else if(oSM.aSM.currentState == oSM.aSM.GroundedState && (Input.GetKeyDown(KeyCode.F) || Input.GetAxis("Kick") != 0) && !oSM.pStats.IsPaused){
else if(oSM.aSM.currentState == oSM.aSM.GroundedState && (Input.GetKeyDown(GameManager.GM.bindableActions["kickKey"]) || Input.GetAxis("Kick") != 0) && !oSM.pStats.IsPaused){
//Regular Kick
oSM.SwitchState(oSM.KickState);
}

View File

@ -27,14 +27,14 @@ EditorUserSettings:
value: 22424703114646680e0b0227036c6f1f05033f2b212d68252320092a
flags: 0
RecentlyUsedScenePath-7:
value: 22424703114646680e0b0227036c7b151b180b6501273035202c1327d1e33136e7a923e7ee2e26
flags: 0
RecentlyUsedScenePath-8:
value: 22424703114646680e0b0227036c731f1415016439262f2434
flags: 0
RecentlyUsedScenePath-9:
RecentlyUsedScenePath-8:
value: 22424703114646680e0b0227036c6f02131b172b282d347e38271427fb
flags: 0
RecentlyUsedScenePath-9:
value: 22424703114646680e0b0227036c7b151b180b6501273035202c1327d1e33136e7a923e7ee2e26
flags: 0
vcSharedLogLevel:
value: 0d5e400f0650
flags: 0