diff --git a/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugAerialState/DebugAerial/dAerialFallingState.cs b/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugAerialState/DebugAerial/dAerialFallingState.cs index 2a8628e..a5d659a 100644 --- a/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugAerialState/DebugAerial/dAerialFallingState.cs +++ b/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugAerialState/DebugAerial/dAerialFallingState.cs @@ -20,7 +20,7 @@ public class dAerialFallingState : dAerialBaseState } //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)){ + 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){ aSM.SwitchState(aSM.GlidingState); } diff --git a/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugAerialState/DebugGrapple/dAerialGrappleAirState.cs b/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugAerialState/DebugGrapple/dAerialGrappleAirState.cs index 69be863..d17ef67 100644 --- a/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugAerialState/DebugGrapple/dAerialGrappleAirState.cs +++ b/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugAerialState/DebugGrapple/dAerialGrappleAirState.cs @@ -68,7 +68,7 @@ public class dAerialGrappleAirState : dAerialBaseState public override void UpdateState(dAerialStateManager aSM){ //if pressing E or ragdolling then falling - if(((Input.GetKeyDown(KeyCode.E) || Input.GetKeyDown(KeyCode.JoystickButton2)) && !aSM.eHeld) || (aSM.mSM.currentState == aSM.mSM.RagdollState)){ + if(((Input.GetKeyDown(KeyCode.E) || Input.GetKeyDown(KeyCode.JoystickButton2)) && !aSM.eHeld && !aSM.pStats.IsPaused) || (aSM.mSM.currentState == aSM.mSM.RagdollState)){ aSM.SwitchState(aSM.FallingState); } else if((Input.GetKeyUp(KeyCode.E) || Input.GetKeyUp(KeyCode.JoystickButton2)) && aSM.eHeld){ @@ -76,7 +76,7 @@ public class dAerialGrappleAirState : dAerialBaseState } //if pressing Jump then jump - else if(Input.GetButton("Jump") && !spaceHeld){ + else if(Input.GetButton("Jump") && !spaceHeld && !aSM.pStats.IsPaused){ aSM.SwitchState(aSM.JumpingState); } else if(!(Input.GetButton("Jump")) && spaceHeld){ diff --git a/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugAerialState/DebugGrapple/dAerialGrappleGroundedState.cs b/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugAerialState/DebugGrapple/dAerialGrappleGroundedState.cs index 20e7325..1daed65 100644 --- a/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugAerialState/DebugGrapple/dAerialGrappleGroundedState.cs +++ b/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugAerialState/DebugGrapple/dAerialGrappleGroundedState.cs @@ -17,7 +17,7 @@ public class dAerialGrappleGroundedState : dAerialBaseState public override void UpdateState(dAerialStateManager aSM){ //if E is pressed or ragdolling then grounded - if(((Input.GetKeyDown(KeyCode.E) || Input.GetKeyDown(KeyCode.JoystickButton2)) && !aSM.eHeld) || (aSM.mSM.currentState == aSM.mSM.RagdollState)){ + if(((Input.GetKeyDown(KeyCode.E) || Input.GetKeyDown(KeyCode.JoystickButton2)) && !aSM.eHeld && !aSM.pStats.IsPaused) || (aSM.mSM.currentState == aSM.mSM.RagdollState)){ aSM.SwitchState(aSM.GroundedState); } else if((Input.GetKeyUp(KeyCode.E) || Input.GetKeyUp(KeyCode.JoystickButton2)) && aSM.eHeld){ diff --git a/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugAerialState/DebugWallRun/dAerialWallRunState.cs b/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugAerialState/DebugWallRun/dAerialWallRunState.cs index a488287..f89b50b 100644 --- a/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugAerialState/DebugWallRun/dAerialWallRunState.cs +++ b/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugAerialState/DebugWallRun/dAerialWallRunState.cs @@ -25,7 +25,7 @@ public class dAerialWallRunState : dAerialBaseState } //if space is pressed then jumping - else if(Input.GetButton("Jump") && !spaceHeld){ + else if(Input.GetButton("Jump") && !spaceHeld && !aSM.pStats.IsPaused){ aSM.SwitchState(aSM.JumpingState); } else if(!Input.GetButton("Jump") && spaceHeld){ diff --git a/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugAerialState/dAerialStateManager.cs b/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugAerialState/dAerialStateManager.cs index cea1424..a04ef20 100644 --- a/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugAerialState/dAerialStateManager.cs +++ b/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugAerialState/dAerialStateManager.cs @@ -268,22 +268,24 @@ public class dAerialStateManager : NetworkBehaviour //applies Jump values and Variables void Jump(){ - //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)) - { - if(currentState == WallRunState){ - AddImpact((GetWallJumpDirection()), pStats.JumpPow * 8.5f); - pStats.GravVel = pStats.JumpPow; - curJumpNum = 0; + 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)) + { + if(currentState == WallRunState){ + AddImpact((GetWallJumpDirection()), pStats.JumpPow * 8.5f); + pStats.GravVel = pStats.JumpPow; + curJumpNum = 0; + } + else{ + pStats.GravVel = pStats.JumpPow; + } + + + curJumpNum++; + jumpHeld = true; + jumpPressed = true; } - else{ - pStats.GravVel = pStats.JumpPow; - } - - - curJumpNum++; - jumpHeld = true; - jumpPressed = true; } //If grounded no jumps have been used and coyote Timer is refreshed @@ -476,15 +478,17 @@ public class dAerialStateManager : NetworkBehaviour ////Grapple Functions //Checks if the player can grapple public bool CheckGrapple(){ - if ((Input.GetKeyDown(KeyCode.E) || Input.GetKeyDown(KeyCode.JoystickButton2)) && pStats.HasGrapple) //If grapple button is hit - { - hookPointIndex = FindHookPoint(); //Find the nearest hook point within max distance - if (hookPointIndex != -1) //If there is a hookpoint - { - hookPoint = hookPoints[hookPointIndex]; //The point we are grappling from - eHeld = true; - return true; - } + if(!pStats.IsPaused){ + if ((Input.GetKeyDown(KeyCode.E) || Input.GetKeyDown(KeyCode.JoystickButton2)) && pStats.HasGrapple) //If grapple button is hit + { + hookPointIndex = FindHookPoint(); //Find the nearest hook point within max distance + if (hookPointIndex != -1) //If there is a hookpoint + { + hookPoint = hookPoints[hookPointIndex]; //The point we are grappling from + eHeld = true; + return true; + } + } } return false; } diff --git a/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugDashState/DebugDash/dDashNoneState.cs b/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugDashState/DebugDash/dDashNoneState.cs index 33824e2..f73bd1a 100644 --- a/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugDashState/DebugDash/dDashNoneState.cs +++ b/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugDashState/DebugDash/dDashNoneState.cs @@ -23,7 +23,7 @@ public class dDashNoneState : dDashBaseState } //if R key then Dashing - else if ((Input.GetKeyDown(KeyCode.R) || Input.GetAxis("Dash") != 0)){ + else if ((Input.GetKeyDown(KeyCode.R) || Input.GetAxis("Dash") != 0) && !dSM.pStats.IsPaused){ dSM.SwitchState(dSM.DashingState); } diff --git a/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugMoveState/DebugWASD/dMoveIdleState.cs b/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugMoveState/DebugWASD/dMoveIdleState.cs index 3261b82..8db5f33 100644 --- a/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugMoveState/DebugWASD/dMoveIdleState.cs +++ b/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugMoveState/DebugWASD/dMoveIdleState.cs @@ -20,7 +20,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.aSM.currentState != mSM.aSM.GrappleGroundedState)){ + 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.aSM.currentState != mSM.aSM.GrappleGroundedState) && !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 5f83367..30c2f9b 100644 --- a/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugMoveState/DebugWASD/dMoveJogState.cs +++ b/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugMoveState/DebugWASD/dMoveJogState.cs @@ -24,7 +24,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.aSM.currentState != mSM.aSM.GrappleGroundedState)){ + 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.aSM.currentState != mSM.aSM.GrappleGroundedState) && !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 6a7cc45..dc51f1c 100644 --- a/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugMoveState/DebugWASD/dMoveRunState.cs +++ b/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugMoveState/DebugWASD/dMoveRunState.cs @@ -20,7 +20,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.aSM.currentState != mSM.aSM.GrappleGroundedState)){ + 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.aSM.currentState != mSM.aSM.GrappleGroundedState) && !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 d96998f..e3f0bdf 100644 --- a/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugMoveState/DebugWASD/dMoveWalkState.cs +++ b/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugMoveState/DebugWASD/dMoveWalkState.cs @@ -24,7 +24,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.aSM.currentState != mSM.aSM.GrappleGroundedState)){ + 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.aSM.currentState != mSM.aSM.GrappleGroundedState) && !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 08dc01b..88c6ee4 100644 --- a/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugMoveState/dMoveStateManager.cs +++ b/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugMoveState/dMoveStateManager.cs @@ -172,7 +172,7 @@ public class dMoveStateManager : NetworkBehaviour //Player Speed Calculator public float PlayerSpeed(){ //If nothing is pressed speed is 0 - if ((Input.GetAxis("Vertical") == 0.0f && Input.GetAxis("Horizontal") == 0.0f)) + if ((Input.GetAxis("Vertical") == 0.0f && Input.GetAxis("Horizontal") == 0.0f) || pStats.IsPaused) { pStats.CurVel = 0.0f; return pStats.CurVel; @@ -261,7 +261,7 @@ public class dMoveStateManager : NetworkBehaviour //Camera and player rotation private void Rotation(){ //If moveController is enabled allow Camera control - if(moveController.enabled){ + if(moveController.enabled && !pStats.IsPaused){ //if input is received from Mouse X if (Input.GetAxis("Mouse X") != 0){ transform.parent.Rotate(Vector3.up * sensitivity * Time.deltaTime * Input.GetAxis("Mouse X")); diff --git a/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugNitroState/DebugNitro/dNitroNoneState.cs b/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugNitroState/DebugNitro/dNitroNoneState.cs index b9e1fe4..787b2b4 100644 --- a/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugNitroState/DebugNitro/dNitroNoneState.cs +++ b/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugNitroState/DebugNitro/dNitroNoneState.cs @@ -23,7 +23,7 @@ public class dNitroNoneState : dNitroBaseState } //if pressing left shift then nitroing - else if ((Input.GetKeyDown(KeyCode.LeftShift) || Input.GetKeyDown(KeyCode.JoystickButton8))) + else if ((Input.GetKeyDown(KeyCode.LeftShift) || Input.GetKeyDown(KeyCode.JoystickButton8)) && !nSM.pStats.IsPaused) { nSM.SwitchState(nSM.NitroingState); } diff --git a/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugOffenseState/DebugOffense/dOffenseNoneState.cs b/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugOffenseState/DebugOffense/dOffenseNoneState.cs index a969d43..a6c9f7e 100644 --- a/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugOffenseState/DebugOffense/dOffenseNoneState.cs +++ b/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugOffenseState/DebugOffense/dOffenseNoneState.cs @@ -20,7 +20,7 @@ public class dOffenseNoneState : dOffenseBaseState } //if grounded then grounded kick states - else if(oSM.aSM.currentState == oSM.aSM.GroundedState && (Input.GetKeyDown(KeyCode.F) || Input.GetAxis("Kick") != 0)){ + else if(oSM.aSM.currentState == oSM.aSM.GroundedState && (Input.GetKeyDown(KeyCode.F) || Input.GetAxis("Kick") != 0) && !oSM.pStats.IsPaused){ //if power is above 300 then punch if(oSM.pStats.KickPow > 300){ @@ -35,7 +35,7 @@ public class dOffenseNoneState : dOffenseBaseState } //if in the air - else if((Input.GetKeyDown(KeyCode.F) || Input.GetAxis("Kick") != 0)){ + else if((Input.GetKeyDown(KeyCode.F) || Input.GetAxis("Kick") != 0) && !oSM.pStats.IsPaused){ //if power is above 300 air punch if(oSM.pStats.KickPow > 300){ diff --git a/Assets/Scripts/PlayerScripts/NetworkedStateMachines/AerialState/Aerial/AerialFallingState.cs b/Assets/Scripts/PlayerScripts/NetworkedStateMachines/AerialState/Aerial/AerialFallingState.cs index 2412c50..23a2643 100644 --- a/Assets/Scripts/PlayerScripts/NetworkedStateMachines/AerialState/Aerial/AerialFallingState.cs +++ b/Assets/Scripts/PlayerScripts/NetworkedStateMachines/AerialState/Aerial/AerialFallingState.cs @@ -20,7 +20,7 @@ public class AerialFallingState : AerialBaseState } //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)){ + 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){ aSM.SwitchState(aSM.GlidingState); } diff --git a/Assets/Scripts/PlayerScripts/NetworkedStateMachines/AerialState/AerialStateManager.cs b/Assets/Scripts/PlayerScripts/NetworkedStateMachines/AerialState/AerialStateManager.cs index c96ef86..1dd2e90 100644 --- a/Assets/Scripts/PlayerScripts/NetworkedStateMachines/AerialState/AerialStateManager.cs +++ b/Assets/Scripts/PlayerScripts/NetworkedStateMachines/AerialState/AerialStateManager.cs @@ -270,22 +270,24 @@ public class AerialStateManager : NetworkBehaviour //applies Jump values and Variables void Jump(){ - //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)) - { - if(currentState == WallRunState){ - AddImpact((GetWallJumpDirection()), pStats.JumpPow * 8.5f); - pStats.GravVel = pStats.JumpPow; - curJumpNum = 0; + 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)) + { + if(currentState == WallRunState){ + AddImpact((GetWallJumpDirection()), pStats.JumpPow * 8.5f); + pStats.GravVel = pStats.JumpPow; + curJumpNum = 0; + } + else{ + pStats.GravVel = pStats.JumpPow; + } + + + curJumpNum++; + jumpHeld = true; + jumpPressed = true; } - else{ - pStats.GravVel = pStats.JumpPow; - } - - - curJumpNum++; - jumpHeld = true; - jumpPressed = true; } //If grounded no jumps have been used and coyote Timer is refreshed @@ -311,7 +313,7 @@ public class AerialStateManager : NetworkBehaviour //Apply Impact for when force needs to be applied without ragdolling public void AddImpact(Vector3 dir, float force){ - //if (!IsLocalPlayer) { return; } + if (!IsLocalPlayer) { return; } //Normalize direction multiply by force and add it to the impact dir.Normalize(); @@ -478,15 +480,17 @@ public class AerialStateManager : NetworkBehaviour ////Grapple Functions //Checks if the player can grapple public bool CheckGrapple(){ - if ((Input.GetKeyDown(KeyCode.E) || Input.GetKeyDown(KeyCode.JoystickButton2)) && pStats.HasGrapple) //If grapple button is hit - { - hookPointIndex = FindHookPoint(); //Find the nearest hook point within max distance - if (hookPointIndex != -1) //If there is a hookpoint - { - hookPoint = hookPoints[hookPointIndex]; //The point we are grappling from - eHeld = true; - return true; - } + if(!pStats.IsPaused){ + if ((Input.GetKeyDown(KeyCode.E) || Input.GetKeyDown(KeyCode.JoystickButton2)) && pStats.HasGrapple) //If grapple button is hit + { + hookPointIndex = FindHookPoint(); //Find the nearest hook point within max distance + if (hookPointIndex != -1) //If there is a hookpoint + { + hookPoint = hookPoints[hookPointIndex]; //The point we are grappling from + eHeld = true; + return true; + } + } } return false; } diff --git a/Assets/Scripts/PlayerScripts/NetworkedStateMachines/AerialState/Grapple/AerialGrappleAirState.cs b/Assets/Scripts/PlayerScripts/NetworkedStateMachines/AerialState/Grapple/AerialGrappleAirState.cs index d54a259..0ab3aa7 100644 --- a/Assets/Scripts/PlayerScripts/NetworkedStateMachines/AerialState/Grapple/AerialGrappleAirState.cs +++ b/Assets/Scripts/PlayerScripts/NetworkedStateMachines/AerialState/Grapple/AerialGrappleAirState.cs @@ -68,7 +68,7 @@ public class AerialGrappleAirState : AerialBaseState public override void UpdateState(AerialStateManager aSM){ //if pressing E or ragdolling then falling - if(((Input.GetKeyDown(KeyCode.E) || Input.GetKeyDown(KeyCode.JoystickButton2)) && !aSM.eHeld) || (aSM.mSM.currentState == aSM.mSM.RagdollState)){ + if(((Input.GetKeyDown(KeyCode.E) || Input.GetKeyDown(KeyCode.JoystickButton2)) && !aSM.eHeld && !aSM.pStats.IsPaused) || (aSM.mSM.currentState == aSM.mSM.RagdollState)){ aSM.SwitchState(aSM.FallingState); } else if((Input.GetKeyUp(KeyCode.E) || Input.GetKeyUp(KeyCode.JoystickButton2)) && aSM.eHeld){ @@ -76,7 +76,7 @@ public class AerialGrappleAirState : AerialBaseState } //if pressing Jump then jump - else if(Input.GetButton("Jump") && !spaceHeld){ + else if(Input.GetButton("Jump") && !spaceHeld && !aSM.pStats.IsPaused){ aSM.SwitchState(aSM.JumpingState); } else if(!(Input.GetButton("Jump")) && spaceHeld){ diff --git a/Assets/Scripts/PlayerScripts/NetworkedStateMachines/AerialState/Grapple/AerialGrappleGroundedState.cs b/Assets/Scripts/PlayerScripts/NetworkedStateMachines/AerialState/Grapple/AerialGrappleGroundedState.cs index 2f9f693..5b0d457 100644 --- a/Assets/Scripts/PlayerScripts/NetworkedStateMachines/AerialState/Grapple/AerialGrappleGroundedState.cs +++ b/Assets/Scripts/PlayerScripts/NetworkedStateMachines/AerialState/Grapple/AerialGrappleGroundedState.cs @@ -17,7 +17,7 @@ public class AerialGrappleGroundedState : AerialBaseState public override void UpdateState(AerialStateManager aSM){ //if E is pressed or ragdolling then grounded - if(((Input.GetKeyDown(KeyCode.E) || Input.GetKeyDown(KeyCode.JoystickButton2)) && !aSM.eHeld) || (aSM.mSM.currentState == aSM.mSM.RagdollState)){ + if(((Input.GetKeyDown(KeyCode.E) || Input.GetKeyDown(KeyCode.JoystickButton2)) && !aSM.eHeld && !aSM.pStats.IsPaused) || (aSM.mSM.currentState == aSM.mSM.RagdollState)){ aSM.SwitchState(aSM.GroundedState); } else if((Input.GetKeyUp(KeyCode.E) || Input.GetKeyUp(KeyCode.JoystickButton2)) && aSM.eHeld){ diff --git a/Assets/Scripts/PlayerScripts/NetworkedStateMachines/AerialState/Wallrun/AerialWallRunState.cs b/Assets/Scripts/PlayerScripts/NetworkedStateMachines/AerialState/Wallrun/AerialWallRunState.cs index 08eb68b..93a55b4 100644 --- a/Assets/Scripts/PlayerScripts/NetworkedStateMachines/AerialState/Wallrun/AerialWallRunState.cs +++ b/Assets/Scripts/PlayerScripts/NetworkedStateMachines/AerialState/Wallrun/AerialWallRunState.cs @@ -25,7 +25,7 @@ public class AerialWallRunState : AerialBaseState } //if space is pressed then jumping - else if(Input.GetButton("Jump") && !spaceHeld){ + else if(Input.GetButton("Jump") && !spaceHeld && !aSM.pStats.IsPaused){ aSM.SwitchState(aSM.JumpingState); } else if(!Input.GetButton("Jump") && spaceHeld){ diff --git a/Assets/Scripts/PlayerScripts/NetworkedStateMachines/DashState/Dash/DashNoneState.cs b/Assets/Scripts/PlayerScripts/NetworkedStateMachines/DashState/Dash/DashNoneState.cs index fd5ca28..ba65a8a 100644 --- a/Assets/Scripts/PlayerScripts/NetworkedStateMachines/DashState/Dash/DashNoneState.cs +++ b/Assets/Scripts/PlayerScripts/NetworkedStateMachines/DashState/Dash/DashNoneState.cs @@ -23,7 +23,7 @@ public class DashNoneState : DashBaseState } //if R key then Dashing - else if ((Input.GetKeyDown(KeyCode.R) || Input.GetAxis("Dash") != 0)){ + else if ((Input.GetKeyDown(KeyCode.R) || Input.GetAxis("Dash") != 0) && !dSM.pStats.IsPaused){ dSM.SwitchState(dSM.DashingState); } diff --git a/Assets/Scripts/PlayerScripts/NetworkedStateMachines/MovementState/MoveStateManager.cs b/Assets/Scripts/PlayerScripts/NetworkedStateMachines/MovementState/MoveStateManager.cs index a0802b8..53c119e 100644 --- a/Assets/Scripts/PlayerScripts/NetworkedStateMachines/MovementState/MoveStateManager.cs +++ b/Assets/Scripts/PlayerScripts/NetworkedStateMachines/MovementState/MoveStateManager.cs @@ -170,7 +170,7 @@ public class MoveStateManager : NetworkBehaviour //Player Speed Calculator public float PlayerSpeed(){ //If nothing is pressed speed is 0 - if ((Input.GetAxis("Vertical") == 0.0f && Input.GetAxis("Horizontal") == 0.0f)) + if ((Input.GetAxis("Vertical") == 0.0f && Input.GetAxis("Horizontal") == 0.0f) || pStats.IsPaused) { pStats.CurVel = 0.0f; return pStats.CurVel; @@ -258,7 +258,7 @@ public class MoveStateManager : NetworkBehaviour //Camera and player rotation private void Rotation(){ //If moveController is enabled allow Camera control - if(moveController.enabled){ + if(moveController.enabled && !pStats.IsPaused){ //if input is received from Mouse X if (Input.GetAxis("Mouse X") != 0){ transform.parent.Rotate(Vector3.up * sensitivity * Time.deltaTime * Input.GetAxis("Mouse X")); diff --git a/Assets/Scripts/PlayerScripts/NetworkedStateMachines/MovementState/WASD/MoveIdleState.cs b/Assets/Scripts/PlayerScripts/NetworkedStateMachines/MovementState/WASD/MoveIdleState.cs index ffdfcf7..982c424 100644 --- a/Assets/Scripts/PlayerScripts/NetworkedStateMachines/MovementState/WASD/MoveIdleState.cs +++ b/Assets/Scripts/PlayerScripts/NetworkedStateMachines/MovementState/WASD/MoveIdleState.cs @@ -20,7 +20,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.aSM.currentState != mSM.aSM.GrappleGroundedState)){ + 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.aSM.currentState != mSM.aSM.GrappleGroundedState) && !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 0785610..d2fdf75 100644 --- a/Assets/Scripts/PlayerScripts/NetworkedStateMachines/MovementState/WASD/MoveJogState.cs +++ b/Assets/Scripts/PlayerScripts/NetworkedStateMachines/MovementState/WASD/MoveJogState.cs @@ -24,7 +24,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.aSM.currentState != mSM.aSM.GrappleGroundedState)){ + 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.aSM.currentState != mSM.aSM.GrappleGroundedState) && !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 9d90f03..b663e29 100644 --- a/Assets/Scripts/PlayerScripts/NetworkedStateMachines/MovementState/WASD/MoveRunState.cs +++ b/Assets/Scripts/PlayerScripts/NetworkedStateMachines/MovementState/WASD/MoveRunState.cs @@ -20,7 +20,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.aSM.currentState != mSM.aSM.GrappleGroundedState)){ + 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.aSM.currentState != mSM.aSM.GrappleGroundedState) && !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 fa4b5b5..636f002 100644 --- a/Assets/Scripts/PlayerScripts/NetworkedStateMachines/MovementState/WASD/MoveWalkState.cs +++ b/Assets/Scripts/PlayerScripts/NetworkedStateMachines/MovementState/WASD/MoveWalkState.cs @@ -24,7 +24,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.aSM.currentState != mSM.aSM.GrappleGroundedState)){ + 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.aSM.currentState != mSM.aSM.GrappleGroundedState) && !mSM.pStats.IsPaused){ mSM.SwitchState(mSM.SlideState); } } diff --git a/Assets/Scripts/PlayerScripts/NetworkedStateMachines/NitroState/Nitro/NitroNoneState.cs b/Assets/Scripts/PlayerScripts/NetworkedStateMachines/NitroState/Nitro/NitroNoneState.cs index 9c2cf99..a63d93e 100644 --- a/Assets/Scripts/PlayerScripts/NetworkedStateMachines/NitroState/Nitro/NitroNoneState.cs +++ b/Assets/Scripts/PlayerScripts/NetworkedStateMachines/NitroState/Nitro/NitroNoneState.cs @@ -23,7 +23,7 @@ public class NitroNoneState : NitroBaseState } //if pressing left shift then nitroing - else if ((Input.GetKeyDown(KeyCode.LeftShift) || Input.GetKeyDown(KeyCode.JoystickButton8))) + else if ((Input.GetKeyDown(KeyCode.LeftShift) || Input.GetKeyDown(KeyCode.JoystickButton8)) && !nSM.pStats.IsPaused) { nSM.SwitchState(nSM.NitroingState); } diff --git a/Assets/Scripts/PlayerScripts/NetworkedStateMachines/OffenseState/Offense/OffenseNoneState.cs b/Assets/Scripts/PlayerScripts/NetworkedStateMachines/OffenseState/Offense/OffenseNoneState.cs index ca3c1ac..00913f0 100644 --- a/Assets/Scripts/PlayerScripts/NetworkedStateMachines/OffenseState/Offense/OffenseNoneState.cs +++ b/Assets/Scripts/PlayerScripts/NetworkedStateMachines/OffenseState/Offense/OffenseNoneState.cs @@ -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)){ + else if(oSM.aSM.currentState == oSM.aSM.GroundedState && (Input.GetKeyDown(KeyCode.F) || Input.GetAxis("Kick") != 0) && !oSM.pStats.IsPaused){ //if power is above 300 then punch if(oSM.pStats.KickPow > 300){ @@ -35,7 +35,7 @@ public class OffenseNoneState : OffenseBaseState } //if in the air - else if((Input.GetKeyDown(KeyCode.F) || Input.GetAxis("Kick") != 0)){ + else if((Input.GetKeyDown(KeyCode.F) || Input.GetAxis("Kick") != 0) && !oSM.pStats.IsPaused){ //if power is above 300 air punch if(oSM.pStats.KickPow > 300){ diff --git a/Assets/Scripts/PlayerScripts/PlayerStats.cs b/Assets/Scripts/PlayerScripts/PlayerStats.cs index da5e7cc..e360cf9 100644 --- a/Assets/Scripts/PlayerScripts/PlayerStats.cs +++ b/Assets/Scripts/PlayerScripts/PlayerStats.cs @@ -5,7 +5,7 @@ using UnityEngine.Assertions; public class PlayerStats : MonoBehaviour { - + //Weather types public enum Weather {Rain, Snow, Wind, Fog}; //Soft cap max speed a player can achieve they can achieve this speed by running @@ -146,21 +146,33 @@ public class PlayerStats : MonoBehaviour set{ playerPoints = value; } } + //Is player paused + [SerializeField] private bool isPaused = false; + public bool IsPaused{ + get{ return isPaused; } + set{ isPaused = value; } + } + + ////Weather Related stats + //Is wind on [SerializeField] private bool windOn = false; public bool WindOn{ get{ return windOn; } } + //Wind direction [SerializeField] private Vector3 windDirection; public Vector3 WindDirection{ get{ return windDirection; } set{ windDirection = value; } } + //temp values for reseting stuff private float tempTraction; private float tempAcc; private float accModification; + //sets weather effect on player public void SetWeather(Weather weather, Vector3 windDir){ switch(weather){ case Weather.Rain:{ @@ -220,6 +232,7 @@ public class PlayerStats : MonoBehaviour } } + //clears weather effects public void ClearWeather(){ acc = tempAcc; @@ -234,6 +247,7 @@ public class PlayerStats : MonoBehaviour windOn = false; } + //// void Update(){ VariableValidation(); diff --git a/Assets/Scripts/UI/PauseMenu.cs b/Assets/Scripts/UI/PauseMenu.cs index 4daf898..a5ce144 100644 --- a/Assets/Scripts/UI/PauseMenu.cs +++ b/Assets/Scripts/UI/PauseMenu.cs @@ -56,20 +56,8 @@ public class PauseMenu : MonoBehaviour { // Find the local player if (player.GetComponent().IsLocalPlayer) { // Have to use if checks since only the runners have these - if (player.GetComponentInChildren() != null) { - player.GetComponentInChildren().enabled = newState; - } - if (player.GetComponentInChildren() != null) { - player.GetComponentInChildren().enabled = newState; - } - if (player.GetComponentInChildren() != null) { - player.GetComponentInChildren().enabled = newState; - } - if (player.GetComponentInChildren() != null) { - player.GetComponentInChildren().enabled = newState; - } - if (player.GetComponentInChildren() != null) { - player.GetComponentInChildren().enabled = newState; + if (player.GetComponentInChildren() != null) { + player.GetComponentInChildren().IsPaused = !newState; } // King's Movement