mirror of
https://github.com/Leahnaya/TheKingsRace.git
synced 2026-08-21 18:04:27 -05:00
Wallrun allows players to hop off wall again
This commit is contained in:
@@ -32,6 +32,7 @@ public class dWallRun : NetworkBehaviour
|
||||
float elapsedTimeSinceJump = 0;
|
||||
float elapsedTimeSinceWallAttach = 0;
|
||||
float elapsedTimeSinceWallDetatch = 0;
|
||||
bool attachOnce = false;
|
||||
bool jumping;
|
||||
|
||||
bool isPlayergrounded() => playerMovementController.isGrounded;
|
||||
@@ -159,7 +160,6 @@ public class dWallRun : NetworkBehaviour
|
||||
|
||||
if((moveToSetNorm.x < 0 && velNorm.x > 0)){
|
||||
moveToSet.x = (moveToSet.x * -velNorm.x);
|
||||
Debug.Log("x");
|
||||
}
|
||||
else if((moveToSetNorm.x > 0 && velNorm.x < 0) ){
|
||||
moveToSet.x = (-moveToSet.x * -velNorm.x);
|
||||
@@ -167,7 +167,6 @@ public class dWallRun : NetworkBehaviour
|
||||
|
||||
if((moveToSetNorm.z < 0 && velNorm.z > 0)){
|
||||
moveToSet.z = (moveToSet.z * -velNorm.z);
|
||||
Debug.Log("z");
|
||||
}
|
||||
else if((moveToSetNorm.z > 0 && velNorm.z < 0)){
|
||||
moveToSet.z = (-moveToSet.z * -velNorm.z);
|
||||
@@ -178,6 +177,11 @@ public class dWallRun : NetworkBehaviour
|
||||
|
||||
playerMovementController.SetPlayerVelocity(moveToSet);
|
||||
isWallRunning = true;
|
||||
if(!attachOnce && playerMovementController.curJumpNum != 0){
|
||||
playerMovementController.curJumpNum = playerMovementController.curJumpNum - 2 ;
|
||||
attachOnce = true;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ public class dPlayerMovement : NetworkBehaviour
|
||||
private CharacterController moveController;
|
||||
|
||||
//Jump value
|
||||
private int curJumpNum;
|
||||
public int curJumpNum;
|
||||
private bool jumpPressed;
|
||||
bool tempSet = false;
|
||||
float tempTraction = 0.0f;
|
||||
@@ -261,7 +261,13 @@ public class dPlayerMovement : NetworkBehaviour
|
||||
//If space is pressed apply an upwards force to the player
|
||||
if (Input.GetAxis("Jump") != 0 && !jumpPressed && curJumpNum + 1 < pStats.JumpNum && !isSliding)
|
||||
{
|
||||
AddImpact(transform.up, pStats.JumpPow);
|
||||
if(wallRun.IsWallRunning()){
|
||||
AddImpact((wallRun.GetWallJumpDirection()), pStats.JumpPow);
|
||||
}
|
||||
else{
|
||||
AddImpact(transform.up, pStats.JumpPow);
|
||||
}
|
||||
|
||||
curJumpNum++;
|
||||
jumpPressed = true;
|
||||
}
|
||||
@@ -357,6 +363,10 @@ public class dPlayerMovement : NetworkBehaviour
|
||||
|
||||
//Wallrunning
|
||||
else if (pStats.HasWallrun) { wallRun.WallRunRoutine(); } //adjusted later if we are wallrunning
|
||||
|
||||
else{
|
||||
vel.y -= pStats.PlayerGrav * Time.deltaTime;
|
||||
}
|
||||
//If gliding
|
||||
//Go down slowly
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user