From a47ee0c4066992f2d27e4f3c5a731cdcb7761439 Mon Sep 17 00:00:00 2001 From: Melbyj1125 <60886701+Melbyj1125@users.noreply.github.com> Date: Mon, 28 Feb 2022 15:19:19 -0600 Subject: [PATCH 1/4] started modifying wind --- .../MovementState/MoveStateManager.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Assets/Scripts/PlayerScripts/NetworkedStateMachines/MovementState/MoveStateManager.cs b/Assets/Scripts/PlayerScripts/NetworkedStateMachines/MovementState/MoveStateManager.cs index dfad391..63c7357 100644 --- a/Assets/Scripts/PlayerScripts/NetworkedStateMachines/MovementState/MoveStateManager.cs +++ b/Assets/Scripts/PlayerScripts/NetworkedStateMachines/MovementState/MoveStateManager.cs @@ -298,6 +298,14 @@ public class MoveStateManager : NetworkBehaviour moveZ = Vector3.zero; driftVel = Vector3.zero; } + + //Apply Wind movement to the player + public void ApplyWind(bool wind){ + if(wind){ + + } + } + //// } From 0ef78f3eb53eeab2b041815a63221f6c8c2ffdee Mon Sep 17 00:00:00 2001 From: Melbyj1125 <60886701+Melbyj1125@users.noreply.github.com> Date: Tue, 1 Mar 2022 17:46:50 -0600 Subject: [PATCH 2/4] wind should work rn --- .../DebugMoveState/dMoveStateManager.cs | 11 +++++++++++ .../MovementState/MoveStateManager.cs | 6 +++++- Assets/Scripts/PlayerScripts/PlayerStats.cs | 10 +++++++++- 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugMoveState/dMoveStateManager.cs b/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugMoveState/dMoveStateManager.cs index 67d7319..08dc01b 100644 --- a/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugMoveState/dMoveStateManager.cs +++ b/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugMoveState/dMoveStateManager.cs @@ -146,6 +146,10 @@ public class dMoveStateManager : NetworkBehaviour //if camera is enabled then rotate if(cam.enabled) Rotation(); else Debug.Log("Cam Disabled"); + + if(moveController.enabled){ + ApplyWind(pStats.WindOn); + } //calls any logic in the fixed update state from current state currentState.FixedUpdateState(this); @@ -301,6 +305,13 @@ public class dMoveStateManager : NetworkBehaviour moveZ = Vector3.zero; driftVel = Vector3.zero; } + + //Apply Wind movement to the player + public void ApplyWind(bool wind){ + if(wind){ + moveController.Move(pStats.WindDirection.normalized * 2); + } + } //// } diff --git a/Assets/Scripts/PlayerScripts/NetworkedStateMachines/MovementState/MoveStateManager.cs b/Assets/Scripts/PlayerScripts/NetworkedStateMachines/MovementState/MoveStateManager.cs index 63c7357..a0802b8 100644 --- a/Assets/Scripts/PlayerScripts/NetworkedStateMachines/MovementState/MoveStateManager.cs +++ b/Assets/Scripts/PlayerScripts/NetworkedStateMachines/MovementState/MoveStateManager.cs @@ -144,6 +144,10 @@ public class MoveStateManager : NetworkBehaviour //if camera is enabled then rotate if(cam.enabled) Rotation(); else Debug.Log("Cam Disabled"); + + if(moveController.enabled){ + ApplyWind(pStats.WindOn); + } //calls any logic in the fixed update state from current state currentState.FixedUpdateState(this); @@ -302,7 +306,7 @@ public class MoveStateManager : NetworkBehaviour //Apply Wind movement to the player public void ApplyWind(bool wind){ if(wind){ - + moveController.Move(pStats.WindDirection.normalized * 2); } } diff --git a/Assets/Scripts/PlayerScripts/PlayerStats.cs b/Assets/Scripts/PlayerScripts/PlayerStats.cs index 78f78cb..da5e7cc 100644 --- a/Assets/Scripts/PlayerScripts/PlayerStats.cs +++ b/Assets/Scripts/PlayerScripts/PlayerStats.cs @@ -151,11 +151,17 @@ public class PlayerStats : MonoBehaviour get{ return windOn; } } + [SerializeField] private Vector3 windDirection; + public Vector3 WindDirection{ + get{ return windDirection; } + set{ windDirection = value; } + } + private float tempTraction; private float tempAcc; private float accModification; - public void SetWeather(Weather weather){ + public void SetWeather(Weather weather, Vector3 windDir){ switch(weather){ case Weather.Rain:{ Debug.Log("Rain"); @@ -195,6 +201,8 @@ public class PlayerStats : MonoBehaviour case Weather.Wind:{ Debug.Log("Wind"); + + windDirection = windDir; windOn = true; break; } From 00c3495461551c7182a82d9dfccdbab2179dc207 Mon Sep 17 00:00:00 2001 From: Melbyj1125 <60886701+Melbyj1125@users.noreply.github.com> Date: Tue, 1 Mar 2022 19:53:23 -0600 Subject: [PATCH 3/4] pause disables inputs instead of scripts --- .../DebugAerial/dAerialFallingState.cs | 2 +- .../DebugGrapple/dAerialGrappleAirState.cs | 4 +- .../dAerialGrappleGroundedState.cs | 2 +- .../DebugWallRun/dAerialWallRunState.cs | 2 +- .../DebugAerialState/dAerialStateManager.cs | 52 +++++++++--------- .../DebugDash/dDashNoneState.cs | 2 +- .../DebugWASD/dMoveIdleState.cs | 2 +- .../DebugMoveState/DebugWASD/dMoveJogState.cs | 2 +- .../DebugMoveState/DebugWASD/dMoveRunState.cs | 2 +- .../DebugWASD/dMoveWalkState.cs | 2 +- .../DebugMoveState/dMoveStateManager.cs | 4 +- .../DebugNitro/dNitroNoneState.cs | 2 +- .../DebugOffense/dOffenseNoneState.cs | 4 +- .../AerialState/Aerial/AerialFallingState.cs | 2 +- .../AerialState/AerialStateManager.cs | 54 ++++++++++--------- .../Grapple/AerialGrappleAirState.cs | 4 +- .../Grapple/AerialGrappleGroundedState.cs | 2 +- .../AerialState/Wallrun/AerialWallRunState.cs | 2 +- .../DashState/Dash/DashNoneState.cs | 2 +- .../MovementState/MoveStateManager.cs | 4 +- .../MovementState/WASD/MoveIdleState.cs | 2 +- .../MovementState/WASD/MoveJogState.cs | 2 +- .../MovementState/WASD/MoveRunState.cs | 2 +- .../MovementState/WASD/MoveWalkState.cs | 2 +- .../NitroState/Nitro/NitroNoneState.cs | 2 +- .../OffenseState/Offense/OffenseNoneState.cs | 4 +- Assets/Scripts/PlayerScripts/PlayerStats.cs | 16 +++++- Assets/Scripts/UI/PauseMenu.cs | 16 +----- 28 files changed, 104 insertions(+), 94 deletions(-) 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 From 741dae95cd5533c847781e03435eeda8a01c7e92 Mon Sep 17 00:00:00 2001 From: Melbyj1125 <60886701+Melbyj1125@users.noreply.github.com> Date: Wed, 2 Mar 2022 12:56:22 -0600 Subject: [PATCH 4/4] weather and pause functionality implemented --- Assets/Prefabs/Player/DebugSMPlayerPrefab.prefab | 11 ++++++++--- Assets/Scenes/Demos/MovementScene.unity | 16 ---------------- .../DebugMoveState/DebugSlide/dMoveSlideState.cs | 2 +- .../DebugMoveState/dMoveStateManager.cs | 6 ++++-- .../MovementState/Slide/MoveSlideState.cs | 2 +- Assets/Scripts/PlayerScripts/PlayerStats.cs | 13 ++++++++----- 6 files changed, 22 insertions(+), 28 deletions(-) diff --git a/Assets/Prefabs/Player/DebugSMPlayerPrefab.prefab b/Assets/Prefabs/Player/DebugSMPlayerPrefab.prefab index aa59e2c..f84e96d 100644 --- a/Assets/Prefabs/Player/DebugSMPlayerPrefab.prefab +++ b/Assets/Prefabs/Player/DebugSMPlayerPrefab.prefab @@ -928,7 +928,7 @@ GameObject: - component: {fileID: 1707207228499037412} - component: {fileID: 1707207228499037411} - component: {fileID: 1707207228499037410} - m_Layer: 0 + m_Layer: 3 m_Name: T-Pose m_TagString: ArcherTarget m_Icon: {fileID: 0} @@ -984,14 +984,16 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: addc2e37ff81c1b4989ec34b6150b4f7, type: 3} m_Name: m_EditorClassIdentifier: - maxVel: 45 + maxVel: 50 minVel: 18 curVel: 0 hardCapMaxVel: 90 acc: 0.02 + curAcc: 0 jumpPow: 60 jumpNum: 2 traction: 5 + curTraction: 0 kickPow: 300 recovTime: 3 playerGrav: 200 @@ -1002,6 +1004,9 @@ MonoBehaviour: hasNitro: 0 hasDash: 0 playerPoints: 15 + isPaused: 0 + windOn: 0 + windDirection: {x: 0, y: 0, z: 0} --- !u!114 &1707207228499037471 MonoBehaviour: m_ObjectHideFlags: 0 @@ -2253,7 +2258,7 @@ GameObject: m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 1 + m_IsActive: 0 --- !u!4 &3454051987037357494 Transform: m_ObjectHideFlags: 0 diff --git a/Assets/Scenes/Demos/MovementScene.unity b/Assets/Scenes/Demos/MovementScene.unity index d7180a6..44b8de4 100644 --- a/Assets/Scenes/Demos/MovementScene.unity +++ b/Assets/Scenes/Demos/MovementScene.unity @@ -3106,18 +3106,6 @@ PrefabInstance: m_Modification: m_TransformParent: {fileID: 0} m_Modifications: - - target: {fileID: 1707207228499037409, guid: 0ea305f96ab853340bb9f0ed320dac08, type: 3} - propertyPath: m_Layer - value: 3 - objectReference: {fileID: 0} - - target: {fileID: 1707207228499037465, guid: 0ea305f96ab853340bb9f0ed320dac08, type: 3} - propertyPath: m_Enabled - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 3454051987037357495, guid: 0ea305f96ab853340bb9f0ed320dac08, type: 3} - propertyPath: m_IsActive - value: 0 - objectReference: {fileID: 0} - target: {fileID: 5759777694531189237, guid: 0ea305f96ab853340bb9f0ed320dac08, type: 3} propertyPath: m_RootOrder value: 10 @@ -3166,9 +3154,5 @@ PrefabInstance: propertyPath: m_Name value: DebugSMPlayerPrefab objectReference: {fileID: 0} - - target: {fileID: 7053551988629990270, guid: 0ea305f96ab853340bb9f0ed320dac08, type: 3} - propertyPath: m_IsActive - value: 1 - objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 0ea305f96ab853340bb9f0ed320dac08, type: 3} diff --git a/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugMoveState/DebugSlide/dMoveSlideState.cs b/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugMoveState/DebugSlide/dMoveSlideState.cs index 2b06912..9bc9519 100644 --- a/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugMoveState/DebugSlide/dMoveSlideState.cs +++ b/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugMoveState/DebugSlide/dMoveSlideState.cs @@ -42,7 +42,7 @@ public class dMoveSlideState : dMoveBaseState } //steadily increase traction - mSM.pStats.Traction += .004f; + 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))){ diff --git a/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugMoveState/dMoveStateManager.cs b/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugMoveState/dMoveStateManager.cs index 88c6ee4..dccd453 100644 --- a/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugMoveState/dMoveStateManager.cs +++ b/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugMoveState/dMoveStateManager.cs @@ -116,8 +116,10 @@ public class dMoveStateManager : NetworkBehaviour //if (!IsLocalPlayer) { return; } Cursor.lockState = CursorLockMode.Locked; // Lock cursor on start if you are the local player - pStats.Traction = pStats.CurTraction; + pStats.CurTraction = pStats.Traction; pStats.CurAcc = pStats.Acc; + + pStats.SetWeather(PlayerStats.Weather.Wind, new Vector3(1,0,0)); } // Update is called once per frame @@ -309,7 +311,7 @@ public class dMoveStateManager : NetworkBehaviour //Apply Wind movement to the player public void ApplyWind(bool wind){ if(wind){ - moveController.Move(pStats.WindDirection.normalized * 2); + moveController.Move(pStats.WindDirection.normalized * .2f); } } //// diff --git a/Assets/Scripts/PlayerScripts/NetworkedStateMachines/MovementState/Slide/MoveSlideState.cs b/Assets/Scripts/PlayerScripts/NetworkedStateMachines/MovementState/Slide/MoveSlideState.cs index 2f4f89d..9c7d1a5 100644 --- a/Assets/Scripts/PlayerScripts/NetworkedStateMachines/MovementState/Slide/MoveSlideState.cs +++ b/Assets/Scripts/PlayerScripts/NetworkedStateMachines/MovementState/Slide/MoveSlideState.cs @@ -42,7 +42,7 @@ public class MoveSlideState : MoveBaseState } //steadily increase traction - mSM.pStats.Traction += .004f; + 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))){ diff --git a/Assets/Scripts/PlayerScripts/PlayerStats.cs b/Assets/Scripts/PlayerScripts/PlayerStats.cs index e360cf9..a991c10 100644 --- a/Assets/Scripts/PlayerScripts/PlayerStats.cs +++ b/Assets/Scripts/PlayerScripts/PlayerStats.cs @@ -173,7 +173,8 @@ public class PlayerStats : MonoBehaviour private float accModification; //sets weather effect on player - public void SetWeather(Weather weather, Vector3 windDir){ + public void SetWeather(Weather weather, Vector3 windDir = default(Vector3)){ + switch(weather){ case Weather.Rain:{ Debug.Log("Rain"); @@ -181,9 +182,9 @@ public class PlayerStats : MonoBehaviour tempTraction = traction; tempAcc = acc; - traction -= 2; - if(curTraction - 2 > 0){ - curTraction -= 2; + traction -= 4; + if(curTraction - 4 > 0){ + curTraction -= 4; } acc += 2; @@ -208,6 +209,8 @@ public class PlayerStats : MonoBehaviour curAcc *= .5f; accModification = -acc; + curVel *= .5f; + break; } @@ -257,7 +260,7 @@ public class PlayerStats : MonoBehaviour Debug.Assert((maxVel >= 0), "maxVel cannot be below zero"); Debug.Assert((minVel >= 0), "minVel cannot be below zero"); Debug.Assert((curVel >= 0), "curVel cannot be below zero"); - Debug.Assert((jumpPow >= 0), "jumpPow cannot be below zero"); + Debug.Assert((jumpPow >= 0), "jumpPow cannot be below zero"); Debug.Assert((jumpNum >= 2), "jumpNum cannot be below 2"); Debug.Assert((traction >= 0), "traction cannot be below zero"); Debug.Assert((kickPow >= 0), "Playerpoints cannot be below zero");