Merge branch 'WeatherPause'

This commit is contained in:
Melbyj1125
2022-03-02 12:58:58 -06:00
32 changed files with 156 additions and 121 deletions

View File

@@ -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);
}

View File

@@ -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){

View File

@@ -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){

View File

@@ -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){

View File

@@ -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;
}

View File

@@ -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);
}

View File

@@ -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))){

View File

@@ -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);
}
}

View File

@@ -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);
}
}

View File

@@ -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);
}
}

View File

@@ -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);
}
}

View File

@@ -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
@@ -146,6 +148,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);
@@ -168,7 +174,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;
@@ -257,7 +263,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"));
@@ -301,6 +307,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 * .2f);
}
}
////
}

View File

@@ -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);
}

View File

@@ -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){

View File

@@ -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);
}

View File

@@ -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;
}

View File

@@ -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){

View File

@@ -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){

View File

@@ -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){

View File

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

View File

@@ -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);
@@ -166,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;
@@ -254,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"));
@@ -298,6 +302,14 @@ public class MoveStateManager : 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);
}
}
////
}

View File

@@ -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))){

View File

@@ -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);
}
}

View File

@@ -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);
}
}

View File

@@ -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);
}
}

View File

@@ -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);
}
}

View File

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

View File

@@ -20,7 +20,7 @@ public class OffenseNoneState : OffenseBaseState
}
//if grounded then grounded kick states
else if(oSM.aSM.currentState == oSM.aSM.GroundedState && (Input.GetKeyDown(KeyCode.F) || Input.GetAxis("Kick") != 0)){
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){

View File

@@ -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,16 +146,35 @@ 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;
public void SetWeather(Weather weather){
//sets weather effect on player
public void SetWeather(Weather weather, Vector3 windDir = default(Vector3)){
switch(weather){
case Weather.Rain:{
Debug.Log("Rain");
@@ -163,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;
@@ -190,11 +209,15 @@ public class PlayerStats : MonoBehaviour
curAcc *= .5f;
accModification = -acc;
curVel *= .5f;
break;
}
case Weather.Wind:{
Debug.Log("Wind");
windDirection = windDir;
windOn = true;
break;
}
@@ -212,6 +235,7 @@ public class PlayerStats : MonoBehaviour
}
}
//clears weather effects
public void ClearWeather(){
acc = tempAcc;
@@ -226,6 +250,7 @@ public class PlayerStats : MonoBehaviour
windOn = false;
}
////
void Update(){
VariableValidation();
@@ -235,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");