diff --git a/Assets/Scenes/Demos/MovementScene.unity b/Assets/Scenes/Demos/MovementScene.unity index 8e50bb7..026e02c 100644 --- a/Assets/Scenes/Demos/MovementScene.unity +++ b/Assets/Scenes/Demos/MovementScene.unity @@ -3466,7 +3466,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 1707207228499037468, guid: 0ea305f96ab853340bb9f0ed320dac08, type: 3} propertyPath: hasGrapple - value: 0 + value: 1 objectReference: {fileID: 0} - target: {fileID: 2088235644774667867, guid: 0ea305f96ab853340bb9f0ed320dac08, type: 3} propertyPath: m_LocalPosition.y diff --git a/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugAerialState/DebugAerial/dAerialFallingState.cs b/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugAerialState/DebugAerial/dAerialFallingState.cs index 6e2ce33..22ea6a9 100644 --- a/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugAerialState/DebugAerial/dAerialFallingState.cs +++ b/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugAerialState/DebugAerial/dAerialFallingState.cs @@ -15,12 +15,12 @@ public class dAerialFallingState : dAerialBaseState public override void UpdateState(dAerialStateManager aSM){ //if Grav Vel > 0 then jumping - if(aSM.pStats.GravVel > 0 && (aSM.mSM.currentState != aSM.mSM.SlideState && aSM.mSM.currentState != aSM.mSM.CrouchState && aSM.mSM.currentState != aSM.mSM.RagdollState && aSM.mSM.currentState != aSM.mSM.RecoveringState)){ + if(aSM.pStats.GravVel > 0 && (aSM.mSM.currentState != aSM.mSM.SlideState && aSM.mSM.currentState != aSM.mSM.CrouchState && aSM.mSM.currentState != aSM.mSM.CrouchWalkState && aSM.mSM.currentState != aSM.mSM.RagdollState && aSM.mSM.currentState != aSM.mSM.RecoveringState)){ aSM.SwitchState(aSM.JumpingState); } //if jump has been pressed and has glider and is in a state that allows it glide - else if(Input.GetButton("Jump") && aSM.pStats.HasGlider && (aSM.mSM.currentState != aSM.mSM.SlideState && aSM.mSM.currentState != aSM.mSM.CrouchState && aSM.mSM.currentState != aSM.mSM.RagdollState && aSM.mSM.currentState != aSM.mSM.RecoveringState) && !aSM.pStats.IsPaused){ + else if(Input.GetButton("Jump") && aSM.pStats.HasGlider && (aSM.mSM.currentState != aSM.mSM.SlideState && aSM.mSM.currentState != aSM.mSM.CrouchState && aSM.mSM.currentState != aSM.mSM.CrouchWalkState && aSM.mSM.currentState != aSM.mSM.RagdollState && aSM.mSM.currentState != aSM.mSM.RecoveringState) && !aSM.pStats.IsPaused){ aSM.SwitchState(aSM.GlidingState); } @@ -30,12 +30,12 @@ public class dAerialFallingState : dAerialBaseState } //if is wallrunning ands is in a state that allows it wallrun - else if(aSM.isWallRunning && (aSM.mSM.currentState != aSM.mSM.SlideState && aSM.mSM.currentState != aSM.mSM.CrouchState && aSM.mSM.currentState != aSM.mSM.RagdollState && aSM.mSM.currentState != aSM.mSM.RecoveringState)){ + else if(aSM.isWallRunning && (aSM.mSM.currentState != aSM.mSM.SlideState && aSM.mSM.currentState != aSM.mSM.CrouchState && aSM.mSM.currentState != aSM.mSM.CrouchWalkState && aSM.mSM.currentState != aSM.mSM.RagdollState && aSM.mSM.currentState != aSM.mSM.RecoveringState)){ aSM.SwitchState(aSM.WallRunState); } //if grapple is possible and in state that allows it grapple air - else if(aSM.CheckGrapple() && (aSM.mSM.currentState != aSM.mSM.SlideState && aSM.mSM.currentState != aSM.mSM.CrouchState && aSM.mSM.currentState != aSM.mSM.RagdollState && aSM.mSM.currentState != aSM.mSM.RecoveringState)){ + else if(aSM.CheckGrapple() && (aSM.mSM.currentState != aSM.mSM.SlideState && aSM.mSM.currentState != aSM.mSM.CrouchState && aSM.mSM.currentState != aSM.mSM.CrouchWalkState && aSM.mSM.currentState != aSM.mSM.RagdollState && aSM.mSM.currentState != aSM.mSM.RecoveringState)){ aSM.SwitchState(aSM.GrappleAirState); } } diff --git a/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugAerialState/DebugAerial/dAerialGroundedState.cs b/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugAerialState/DebugAerial/dAerialGroundedState.cs index 63e23a0..76767de 100644 --- a/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugAerialState/DebugAerial/dAerialGroundedState.cs +++ b/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugAerialState/DebugAerial/dAerialGroundedState.cs @@ -19,16 +19,16 @@ public class dAerialGroundedState : dAerialBaseState public override void UpdateState(dAerialStateManager aSM){ //if grav vel < 0 then falling - if(aSM.pStats.GravVel < 0 || (aSM.pStats.GravVel > 0 && (aSM.mSM.currentState == aSM.mSM.SlideState || aSM.mSM.currentState == aSM.mSM.CrouchState || aSM.mSM.currentState == aSM.mSM.RagdollState || aSM.mSM.currentState == aSM.mSM.RecoveringState))){ + if(aSM.pStats.GravVel < 0 || (aSM.pStats.GravVel > 0 && (aSM.mSM.currentState == aSM.mSM.SlideState || aSM.mSM.currentState == aSM.mSM.CrouchState || aSM.mSM.currentState == aSM.mSM.CrouchWalkState || aSM.mSM.currentState == aSM.mSM.RagdollState || aSM.mSM.currentState == aSM.mSM.RecoveringState))){ aSM.SwitchState(aSM.FallingState); } //if grav vel > 0 then jumping - else if(aSM.pStats.GravVel > 0 && (aSM.mSM.currentState != aSM.mSM.SlideState && aSM.mSM.currentState != aSM.mSM.CrouchState && aSM.mSM.currentState != aSM.mSM.RagdollState && aSM.mSM.currentState != aSM.mSM.RecoveringState)){ + else if(aSM.pStats.GravVel > 0 && (aSM.mSM.currentState != aSM.mSM.SlideState && aSM.mSM.currentState != aSM.mSM.CrouchState && aSM.mSM.currentState != aSM.mSM.CrouchWalkState && aSM.mSM.currentState != aSM.mSM.RagdollState && aSM.mSM.currentState != aSM.mSM.RecoveringState)){ aSM.SwitchState(aSM.JumpingState); } //can grapple and in state that allows grapple - else if(aSM.CheckGrapple() && (aSM.mSM.currentState != aSM.mSM.SlideState && aSM.mSM.currentState != aSM.mSM.CrouchState && aSM.mSM.currentState != aSM.mSM.RagdollState && aSM.mSM.currentState != aSM.mSM.RecoveringState)){ + else if(aSM.CheckGrapple() && (aSM.mSM.currentState != aSM.mSM.SlideState && aSM.mSM.currentState != aSM.mSM.CrouchState && aSM.mSM.currentState != aSM.mSM.CrouchWalkState && aSM.mSM.currentState != aSM.mSM.RagdollState && aSM.mSM.currentState != aSM.mSM.RecoveringState)){ aSM.SwitchState(aSM.GrappleAirState); } } diff --git a/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugAerialState/dAerialStateManager.cs b/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugAerialState/dAerialStateManager.cs index 91f04d0..5bb42b1 100644 --- a/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugAerialState/dAerialStateManager.cs +++ b/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugAerialState/dAerialStateManager.cs @@ -263,7 +263,7 @@ public class dAerialStateManager : NetworkBehaviour void Jump(){ if(!pStats.IsPaused){ //If space/south gamepad button is pressed apply an upwards force to the player - if (Input.GetAxis("Jump") != 0 && !jumpHeld && curJumpNum < pStats.JumpNum && (mSM.currentState != mSM.SlideState && mSM.currentState != mSM.CrouchState && mSM.currentState != mSM.RagdollState && mSM.currentState != mSM.RecoveringState && currentState != GlidingState)) + if (Input.GetAxis("Jump") != 0 && !jumpHeld && curJumpNum < pStats.JumpNum && (mSM.currentState != mSM.SlideState && mSM.currentState != mSM.CrouchState && mSM.currentState != mSM.CrouchWalkState && mSM.currentState != mSM.RagdollState && mSM.currentState != mSM.RecoveringState && currentState != GlidingState)) { if(currentState == WallRunState){ AddImpact((GetWallJumpDirection()), pStats.JumpPow * 8.5f); diff --git a/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugMoveState/DebugWASD/dMoveIdleState.cs b/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugMoveState/DebugWASD/dMoveIdleState.cs index fc26613..3fb7cfd 100644 --- a/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugMoveState/DebugWASD/dMoveIdleState.cs +++ b/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugMoveState/DebugWASD/dMoveIdleState.cs @@ -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.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.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); } } diff --git a/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugMoveState/DebugWASD/dMoveJogState.cs b/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugMoveState/DebugWASD/dMoveJogState.cs index 548e574..7bfdb6f 100644 --- a/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugMoveState/DebugWASD/dMoveJogState.cs +++ b/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugMoveState/DebugWASD/dMoveJogState.cs @@ -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.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.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); } } diff --git a/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugMoveState/DebugWASD/dMoveRunState.cs b/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugMoveState/DebugWASD/dMoveRunState.cs index ecae4ad..d39a3b7 100644 --- a/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugMoveState/DebugWASD/dMoveRunState.cs +++ b/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugMoveState/DebugWASD/dMoveRunState.cs @@ -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.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.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); } } diff --git a/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugMoveState/DebugWASD/dMoveWalkState.cs b/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugMoveState/DebugWASD/dMoveWalkState.cs index b991023..a6ae753 100644 --- a/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugMoveState/DebugWASD/dMoveWalkState.cs +++ b/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugMoveState/DebugWASD/dMoveWalkState.cs @@ -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.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.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); } } diff --git a/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugMoveState/dMoveStateManager.cs b/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugMoveState/dMoveStateManager.cs index 591094d..c464d07 100644 --- a/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugMoveState/dMoveStateManager.cs +++ b/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugMoveState/dMoveStateManager.cs @@ -136,7 +136,7 @@ public class dMoveStateManager : NetworkBehaviour //if grappling in aerial state manager swap to grapple here if(currentState != GrappleAirState){ - if(aSM.currentState == aSM.GrappleAirState && (currentState != SlideState && currentState != CrouchState && currentState != RagdollState && currentState != RecoveringState)){ + if(aSM.currentState == aSM.GrappleAirState && (currentState != SlideState && currentState != CrouchState && currentState != CrouchWalkState && currentState != RagdollState && currentState != RecoveringState)){ SwitchState(GrappleAirState); } } @@ -264,12 +264,12 @@ public class dMoveStateManager : NetworkBehaviour //Check if wall is in direction player is moving - if (((Physics.Raycast(gameObject.transform.position + new Vector3(0,.4f,0) + rayOffset, driftVel.normalized, out wallHitBot, .35f, layerMask) == true) || ((currentState != SlideState || currentState != CrouchState) && (Physics.Raycast(gameObject.transform.position + new Vector3(0,2.2f,0), driftVel.normalized, out wallHitTop, .35f, layerMask) == true))) && !firstWallHit){ + if (((Physics.Raycast(gameObject.transform.position + new Vector3(0,.4f,0) + rayOffset, driftVel.normalized, out wallHitBot, .35f, layerMask) == true) || ((currentState != SlideState || currentState != CrouchState || currentState == CrouchWalkState) && (Physics.Raycast(gameObject.transform.position + new Vector3(0,2.2f,0), driftVel.normalized, out wallHitTop, .35f, layerMask) == true))) && !firstWallHit){ CancelMomentum(); //Debug.Log(wallHitBot.collider.name); firstWallHit = true; } - if(((Physics.Raycast(gameObject.transform.position + new Vector3(0,.4f,0) + rayOffset, driftVel.normalized, out wallExitBot, .3f, layerMask) == false) && ((currentState == SlideState || currentState == CrouchState) || (Physics.Raycast(gameObject.transform.position + new Vector3(0,2.2f,0), driftVel.normalized, out wallExitTop, .3f, layerMask) == false))) && firstWallHit){ + if(((Physics.Raycast(gameObject.transform.position + new Vector3(0,.4f,0) + rayOffset, driftVel.normalized, out wallExitBot, .3f, layerMask) == false) && ((currentState == SlideState || currentState == CrouchState || currentState == CrouchWalkState) || (Physics.Raycast(gameObject.transform.position + new Vector3(0,2.2f,0), driftVel.normalized, out wallExitTop, .3f, layerMask) == false))) && firstWallHit){ firstWallHit = false; } diff --git a/Assets/Scripts/PlayerScripts/NetworkedStateMachines/AerialState/Aerial/AerialFallingState.cs b/Assets/Scripts/PlayerScripts/NetworkedStateMachines/AerialState/Aerial/AerialFallingState.cs index 974fba7..9664a03 100644 --- a/Assets/Scripts/PlayerScripts/NetworkedStateMachines/AerialState/Aerial/AerialFallingState.cs +++ b/Assets/Scripts/PlayerScripts/NetworkedStateMachines/AerialState/Aerial/AerialFallingState.cs @@ -15,14 +15,14 @@ public class AerialFallingState : AerialBaseState public override void UpdateState(AerialStateManager aSM){ //if Grav Vel > 0 then jumping - if(aSM.pStats.GravVel > 0 && (aSM.mSM.currentState != aSM.mSM.SlideState && aSM.mSM.currentState != aSM.mSM.CrouchState && aSM.mSM.currentState != aSM.mSM.RagdollState && aSM.mSM.currentState != aSM.mSM.RecoveringState)){ + if(aSM.pStats.GravVel > 0 && (aSM.mSM.currentState != aSM.mSM.SlideState && aSM.mSM.currentState != aSM.mSM.CrouchState && aSM.mSM.currentState != aSM.mSM.CrouchWalkState && aSM.mSM.currentState != aSM.mSM.RagdollState && aSM.mSM.currentState != aSM.mSM.RecoveringState)){ Debug.Log("Going to Jump From Fall"); aSM.SwitchState(aSM.JumpingState); } //if jump has been pressed and has glider and is in a state that allows it glide - else if(Input.GetButton("Jump") && aSM.pStats.HasGlider && (aSM.mSM.currentState != aSM.mSM.SlideState && aSM.mSM.currentState != aSM.mSM.CrouchState && aSM.mSM.currentState != aSM.mSM.RagdollState && aSM.mSM.currentState != aSM.mSM.RecoveringState) && !aSM.pStats.IsPaused){ + else if(Input.GetButton("Jump") && aSM.pStats.HasGlider && (aSM.mSM.currentState != aSM.mSM.SlideState && aSM.mSM.currentState != aSM.mSM.CrouchState && aSM.mSM.currentState != aSM.mSM.CrouchWalkState && aSM.mSM.currentState != aSM.mSM.RagdollState && aSM.mSM.currentState != aSM.mSM.RecoveringState) && !aSM.pStats.IsPaused){ Debug.Log("Going to Glide From Fall"); aSM.SwitchState(aSM.GlidingState); } @@ -33,12 +33,12 @@ public class AerialFallingState : AerialBaseState } //if is wallrunning ands is in a state that allows it wallrun - else if(aSM.isWallRunning && (aSM.mSM.currentState != aSM.mSM.SlideState && aSM.mSM.currentState != aSM.mSM.CrouchState && aSM.mSM.currentState != aSM.mSM.RagdollState && aSM.mSM.currentState != aSM.mSM.RecoveringState)){ + else if(aSM.isWallRunning && (aSM.mSM.currentState != aSM.mSM.SlideState && aSM.mSM.currentState != aSM.mSM.CrouchState && aSM.mSM.currentState != aSM.mSM.CrouchWalkState && aSM.mSM.currentState != aSM.mSM.RagdollState && aSM.mSM.currentState != aSM.mSM.RecoveringState)){ aSM.SwitchState(aSM.WallRunState); } //if grapple is possible and in state that allows it grapple air - else if(aSM.CheckGrapple() && (aSM.mSM.currentState != aSM.mSM.SlideState && aSM.mSM.currentState != aSM.mSM.CrouchState && aSM.mSM.currentState != aSM.mSM.RagdollState && aSM.mSM.currentState != aSM.mSM.RecoveringState)){ + else if(aSM.CheckGrapple() && (aSM.mSM.currentState != aSM.mSM.SlideState && aSM.mSM.currentState != aSM.mSM.CrouchState && aSM.mSM.currentState != aSM.mSM.CrouchWalkState && aSM.mSM.currentState != aSM.mSM.RagdollState && aSM.mSM.currentState != aSM.mSM.RecoveringState)){ aSM.SwitchState(aSM.GrappleAirState); } } diff --git a/Assets/Scripts/PlayerScripts/NetworkedStateMachines/AerialState/Aerial/AerialGroundedState.cs b/Assets/Scripts/PlayerScripts/NetworkedStateMachines/AerialState/Aerial/AerialGroundedState.cs index 2aac507..94b2dbe 100644 --- a/Assets/Scripts/PlayerScripts/NetworkedStateMachines/AerialState/Aerial/AerialGroundedState.cs +++ b/Assets/Scripts/PlayerScripts/NetworkedStateMachines/AerialState/Aerial/AerialGroundedState.cs @@ -17,13 +17,18 @@ public class AerialGroundedState : AerialBaseState public override void UpdateState(AerialStateManager aSM){ //if grav vel < 0 then falling - if(aSM.pStats.GravVel < 0 || (aSM.pStats.GravVel > 0 && (aSM.mSM.currentState == aSM.mSM.SlideState || aSM.mSM.currentState == aSM.mSM.CrouchState || aSM.mSM.currentState == aSM.mSM.RagdollState || aSM.mSM.currentState == aSM.mSM.RecoveringState))){ + if(aSM.pStats.GravVel < 0 || (aSM.pStats.GravVel > 0 && (aSM.mSM.currentState == aSM.mSM.SlideState || aSM.mSM.currentState == aSM.mSM.CrouchState || aSM.mSM.currentState == aSM.mSM.CrouchWalkState || aSM.mSM.currentState == aSM.mSM.RagdollState || aSM.mSM.currentState == aSM.mSM.RecoveringState))){ aSM.SwitchState(aSM.FallingState); } //if grav vel > 0 then jumping - else if(aSM.pStats.GravVel > 0 && (aSM.mSM.currentState != aSM.mSM.SlideState && aSM.mSM.currentState != aSM.mSM.CrouchState && aSM.mSM.currentState != aSM.mSM.RagdollState && aSM.mSM.currentState != aSM.mSM.RecoveringState)){ + else if(aSM.pStats.GravVel > 0 && (aSM.mSM.currentState != aSM.mSM.SlideState && aSM.mSM.currentState != aSM.mSM.CrouchState && aSM.mSM.currentState != aSM.mSM.CrouchWalkState && aSM.mSM.currentState != aSM.mSM.RagdollState && aSM.mSM.currentState != aSM.mSM.RecoveringState)){ aSM.SwitchState(aSM.JumpingState); } + + //can grapple and in state that allows grapple + else if(aSM.CheckGrapple() && (aSM.mSM.currentState != aSM.mSM.SlideState && aSM.mSM.currentState != aSM.mSM.CrouchState && aSM.mSM.currentState != aSM.mSM.CrouchWalkState && aSM.mSM.currentState != aSM.mSM.RagdollState && aSM.mSM.currentState != aSM.mSM.RecoveringState)){ + aSM.SwitchState(aSM.GrappleAirState); + } } public override void FixedUpdateState(AerialStateManager aSM){ diff --git a/Assets/Scripts/PlayerScripts/NetworkedStateMachines/AerialState/AerialStateManager.cs b/Assets/Scripts/PlayerScripts/NetworkedStateMachines/AerialState/AerialStateManager.cs index fe915fc..dac9162 100644 --- a/Assets/Scripts/PlayerScripts/NetworkedStateMachines/AerialState/AerialStateManager.cs +++ b/Assets/Scripts/PlayerScripts/NetworkedStateMachines/AerialState/AerialStateManager.cs @@ -292,7 +292,7 @@ public class AerialStateManager : NetworkBehaviour void Jump(){ if(!pStats.IsPaused){ //If space/south gamepad button is pressed apply an upwards force to the player - if (Input.GetAxis("Jump") != 0 && !jumpHeld && curJumpNum < pStats.JumpNum && (mSM.currentState != mSM.SlideState && mSM.currentState != mSM.CrouchState && mSM.currentState != mSM.RagdollState && mSM.currentState != mSM.RecoveringState && currentState != GlidingState)) + if (Input.GetAxis("Jump") != 0 && !jumpHeld && curJumpNum < pStats.JumpNum && (mSM.currentState != mSM.SlideState && mSM.currentState != mSM.CrouchState && mSM.currentState != mSM.CrouchWalkState && mSM.currentState != mSM.RagdollState && mSM.currentState != mSM.RecoveringState && currentState != GlidingState)) { if(currentState == WallRunState){ AddImpact((GetWallJumpDirection()), pStats.JumpPow * 8.5f); diff --git a/Assets/Scripts/PlayerScripts/NetworkedStateMachines/MovementState/MoveStateManager.cs b/Assets/Scripts/PlayerScripts/NetworkedStateMachines/MovementState/MoveStateManager.cs index c118f1c..4da84de 100644 --- a/Assets/Scripts/PlayerScripts/NetworkedStateMachines/MovementState/MoveStateManager.cs +++ b/Assets/Scripts/PlayerScripts/NetworkedStateMachines/MovementState/MoveStateManager.cs @@ -146,7 +146,7 @@ public class MoveStateManager : NetworkBehaviour //if grappling in aerial state manager swap to grapple here if(currentState != GrappleAirState){ - if(aSM.currentState == aSM.GrappleAirState && (currentState != SlideState && currentState != RagdollState && currentState != RecoveringState)){ + if(aSM.currentState == aSM.GrappleAirState && (currentState != SlideState && currentState != CrouchState && currentState != CrouchWalkState && currentState != RagdollState && currentState != RecoveringState)){ SwitchState(GrappleAirState); } } @@ -274,12 +274,12 @@ public class MoveStateManager : NetworkBehaviour //Check if wall is in direction player is moving - if (((Physics.Raycast(gameObject.transform.position + new Vector3(0,.4f,0) + rayOffset, driftVel.normalized, out wallHitBot, .35f, layerMask) == true) || ((currentState != SlideState || currentState != CrouchState) && (Physics.Raycast(gameObject.transform.position + new Vector3(0,2.2f,0), driftVel.normalized, out wallHitTop, .35f, layerMask) == true))) && !firstWallHit){ + if (((Physics.Raycast(gameObject.transform.position + new Vector3(0,.4f,0) + rayOffset, driftVel.normalized, out wallHitBot, .35f, layerMask) == true) || ((currentState != SlideState || currentState != CrouchState || currentState == CrouchWalkState) && (Physics.Raycast(gameObject.transform.position + new Vector3(0,2.2f,0), driftVel.normalized, out wallHitTop, .35f, layerMask) == true))) && !firstWallHit){ CancelMomentum(); //Debug.Log(wallHitBot.collider.name); firstWallHit = true; } - if(((Physics.Raycast(gameObject.transform.position + new Vector3(0,.4f,0) + rayOffset, driftVel.normalized, out wallExitBot, .3f, layerMask) == false) && ((currentState == SlideState || currentState == CrouchState) || (Physics.Raycast(gameObject.transform.position + new Vector3(0,2.2f,0), driftVel.normalized, out wallExitTop, .3f, layerMask) == false))) && firstWallHit){ + if(((Physics.Raycast(gameObject.transform.position + new Vector3(0,.4f,0) + rayOffset, driftVel.normalized, out wallExitBot, .3f, layerMask) == false) && ((currentState == SlideState || currentState == CrouchState || currentState == CrouchWalkState) || (Physics.Raycast(gameObject.transform.position + new Vector3(0,2.2f,0), driftVel.normalized, out wallExitTop, .3f, layerMask) == false))) && firstWallHit){ firstWallHit = false; } diff --git a/Assets/Scripts/PlayerScripts/NetworkedStateMachines/MovementState/WASD/MoveIdleState.cs b/Assets/Scripts/PlayerScripts/NetworkedStateMachines/MovementState/WASD/MoveIdleState.cs index 2688152..b0787f1 100644 --- a/Assets/Scripts/PlayerScripts/NetworkedStateMachines/MovementState/WASD/MoveIdleState.cs +++ b/Assets/Scripts/PlayerScripts/NetworkedStateMachines/MovementState/WASD/MoveIdleState.cs @@ -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.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.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); } } diff --git a/Assets/Scripts/PlayerScripts/NetworkedStateMachines/MovementState/WASD/MoveJogState.cs b/Assets/Scripts/PlayerScripts/NetworkedStateMachines/MovementState/WASD/MoveJogState.cs index c445c82..c4ec41a 100644 --- a/Assets/Scripts/PlayerScripts/NetworkedStateMachines/MovementState/WASD/MoveJogState.cs +++ b/Assets/Scripts/PlayerScripts/NetworkedStateMachines/MovementState/WASD/MoveJogState.cs @@ -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.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.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); } } diff --git a/Assets/Scripts/PlayerScripts/NetworkedStateMachines/MovementState/WASD/MoveRunState.cs b/Assets/Scripts/PlayerScripts/NetworkedStateMachines/MovementState/WASD/MoveRunState.cs index 813d533..62183d1 100644 --- a/Assets/Scripts/PlayerScripts/NetworkedStateMachines/MovementState/WASD/MoveRunState.cs +++ b/Assets/Scripts/PlayerScripts/NetworkedStateMachines/MovementState/WASD/MoveRunState.cs @@ -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.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.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); } } diff --git a/Assets/Scripts/PlayerScripts/NetworkedStateMachines/MovementState/WASD/MoveWalkState.cs b/Assets/Scripts/PlayerScripts/NetworkedStateMachines/MovementState/WASD/MoveWalkState.cs index ad0bb5f..80beeca 100644 --- a/Assets/Scripts/PlayerScripts/NetworkedStateMachines/MovementState/WASD/MoveWalkState.cs +++ b/Assets/Scripts/PlayerScripts/NetworkedStateMachines/MovementState/WASD/MoveWalkState.cs @@ -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.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.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); } }