mirror of
https://github.com/Leahnaya/TheKingsRace.git
synced 2026-08-22 10:24:42 -05:00
Updated nitro restoring functionality and buffing
This commit is contained in:
@@ -54,7 +54,7 @@ public class dDash : NetworkBehaviour{
|
||||
private IEnumerator startCoolDown(){
|
||||
Debug.Log("start corotine");
|
||||
isOnCoolDown = true;
|
||||
driver.startUICooldown(dashItem.name);
|
||||
//driver.startUICooldown(dashItem.name);
|
||||
yield return new WaitForSeconds(dashItem.cooldownM);
|
||||
isOnCoolDown = false;
|
||||
Debug.Log("end corotine");
|
||||
|
||||
@@ -172,7 +172,6 @@ public class dGrapplingHook : NetworkBehaviour
|
||||
swingback = true;
|
||||
release = false;
|
||||
}
|
||||
Debug.Log(playerMovement.isGrounded);
|
||||
}
|
||||
|
||||
//Finds the nearest hook to the player
|
||||
@@ -226,14 +225,14 @@ public class dGrapplingHook : NetworkBehaviour
|
||||
if(oldXZDir != curXZDir){
|
||||
//midpointMom = swingMom;
|
||||
swingback = false;
|
||||
Debug.Log("flip");
|
||||
//Debug.Log("flip");
|
||||
}
|
||||
|
||||
if(swingback == false && swingMom <= (oldSwingMom*(.75f))){
|
||||
swingback = true;
|
||||
oldSwingMom = swingMom;
|
||||
oldXZDir = (new Vector3(hookPoint.transform.position.x,0,hookPoint.transform.position.z) - new Vector3(transform.position.x,0,transform.position.z)).normalized;
|
||||
Debug.Log("swingback");
|
||||
//Debug.Log("swingback");
|
||||
}
|
||||
|
||||
curXZDir = (new Vector3(hPoint.x,0,hPoint.z) - new Vector3(transform.position.x,0,transform.position.z)).normalized;
|
||||
@@ -254,7 +253,6 @@ public class dGrapplingHook : NetworkBehaviour
|
||||
if(sMom > maxSwingMom){
|
||||
sMom = maxSwingMom;
|
||||
}
|
||||
Debug.Log(playerSpeed);
|
||||
return sMom;
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,9 @@ public class dNitro : MonoBehaviour
|
||||
private PlayerStats playerStats;
|
||||
public SpecialItem nitroItem;
|
||||
private bool isOnCoolDown = false;
|
||||
private bool isNitroing = false;
|
||||
public bool isNitroing = false;
|
||||
|
||||
private float tempTimer = 5;
|
||||
//this will need to be set from scritable object or something;
|
||||
|
||||
// Start is called before the first frame update
|
||||
@@ -24,23 +26,40 @@ public class dNitro : MonoBehaviour
|
||||
//once cooldowns are implemented, put this on one (a long one)
|
||||
if (Input.GetKeyDown(KeyCode.LeftShift) && isOnCoolDown == false && playerStats.HasNitro)
|
||||
{
|
||||
if(playerStats.CurVel < playerStats.HardCapMaxVel){
|
||||
playerStats.CurVel += playerStats.Acc * 10;
|
||||
}
|
||||
else if(playerStats.CurVel > playerStats.HardCapMaxVel){
|
||||
playerStats.CurVel = playerStats.HardCapMaxVel;
|
||||
}
|
||||
isNitroing = true;
|
||||
|
||||
StartCoroutine(startCoolDown());
|
||||
}
|
||||
}
|
||||
|
||||
void FixedUpdate(){
|
||||
if(isNitroing){
|
||||
if(tempTimer > 0){
|
||||
|
||||
tempTimer -= .04f;
|
||||
|
||||
Debug.Log("nitro is on");
|
||||
|
||||
if(playerStats.CurVel < playerStats.HardCapMaxVel){
|
||||
playerStats.CurVel += playerStats.Acc * 10;
|
||||
}
|
||||
else if(playerStats.CurVel > playerStats.HardCapMaxVel){
|
||||
playerStats.CurVel = playerStats.HardCapMaxVel;
|
||||
}
|
||||
}
|
||||
else{
|
||||
StartCoroutine(startCoolDown());
|
||||
isNitroing = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private IEnumerator startCoolDown(){
|
||||
Debug.Log("start corotine");
|
||||
isOnCoolDown = true;
|
||||
driver.startUICooldown("Nitro");
|
||||
//driver.startUICooldown("Nitro");
|
||||
yield return new WaitForSeconds(nitroItem.cooldownM);
|
||||
isOnCoolDown = false;
|
||||
tempTimer = 5;
|
||||
Debug.Log("end corotine");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -94,6 +94,9 @@ public class dPlayerMovement : NetworkBehaviour
|
||||
|
||||
//Grapple
|
||||
private dGrapplingHook grapple;
|
||||
|
||||
//Nitro
|
||||
private dNitro nitro;
|
||||
|
||||
|
||||
//Animation controller
|
||||
@@ -114,6 +117,7 @@ public class dPlayerMovement : NetworkBehaviour
|
||||
wallRun = GetComponent<dWallRun>(); //Wallrun
|
||||
blink = GetComponent<dBlink>(); //Blink
|
||||
grapple = GetComponent<dGrapplingHook>();
|
||||
nitro = GetComponent<dNitro>();
|
||||
|
||||
//Get parents up direction
|
||||
up = GetComponentInParent<Transform>().up;
|
||||
@@ -255,12 +259,15 @@ public class dPlayerMovement : NetworkBehaviour
|
||||
return pStats.CurVel;
|
||||
}
|
||||
//If the players speed is above or equal to max speed set speed to max
|
||||
else if (pStats.CurVel >= pStats.MaxVel)
|
||||
else if (pStats.CurVel >= pStats.MaxVel && nitro.isNitroing == false)
|
||||
{
|
||||
pStats.CurVel = pStats.MaxVel;
|
||||
return pStats.CurVel;
|
||||
|
||||
}
|
||||
else if(nitro.isNitroing){
|
||||
return pStats.CurVel;
|
||||
}
|
||||
else{
|
||||
Debug.Log("Something has gone wrong with the PlayerSpeed()");
|
||||
return -1;
|
||||
|
||||
@@ -31,7 +31,7 @@ public class Dash : NetworkBehaviour{
|
||||
}
|
||||
|
||||
void DashPlayer(){
|
||||
if (!IsLocalPlayer) { return; }
|
||||
//if (!IsLocalPlayer) { return; }
|
||||
if(characterController.enabled == true){
|
||||
if (Input.GetKeyDown(KeyCode.R) && isOnCoolDown == false)
|
||||
{
|
||||
@@ -54,7 +54,7 @@ public class Dash : NetworkBehaviour{
|
||||
private IEnumerator startCoolDown(){
|
||||
Debug.Log("start corotine");
|
||||
isOnCoolDown = true;
|
||||
//driver.startUICooldown("Nitro");
|
||||
//driver.startUICooldown(dashItem.name);
|
||||
yield return new WaitForSeconds(dashItem.cooldownM);
|
||||
isOnCoolDown = false;
|
||||
Debug.Log("end corotine");
|
||||
|
||||
@@ -22,24 +22,32 @@ public class GrapplingHook : NetworkBehaviour
|
||||
float inclinationAngle;
|
||||
float theta = -1;
|
||||
|
||||
private float maxSwingSpeed = 90;
|
||||
private float minSwingSpeed = 10;
|
||||
private float swingSpeed = 0;
|
||||
private float maxSwingSpeed = 50;
|
||||
private float minSwingSpeed = 20;
|
||||
private float swingAcc = 3f;
|
||||
private float swingSpeed = 10;
|
||||
|
||||
private float swingMom;
|
||||
private float maxSwingMom = 60;
|
||||
|
||||
private float swingMom = 40;
|
||||
private Vector3 tensionMomDirection;
|
||||
private Vector3 hookPointRight;
|
||||
private Vector3 momDirection;
|
||||
|
||||
private Vector3 curXZDir;
|
||||
private Vector3 oldXZDir;
|
||||
private float flip = -1; // flip variables for swing momentum
|
||||
|
||||
private bool swingback = false; //swing the player back
|
||||
private float midpointMom;
|
||||
private float oldSwingMom;
|
||||
|
||||
Vector3 tensionDirection;
|
||||
float tensionForce;
|
||||
public Vector3 forceDirection;
|
||||
|
||||
private Vector3 tempRelease;
|
||||
private Vector3 lerpRelease;
|
||||
bool release = false;
|
||||
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
@@ -54,7 +62,7 @@ public class GrapplingHook : NetworkBehaviour
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
if (!IsLocalPlayer) { return; }
|
||||
//if (!IsLocalPlayer) { return; }
|
||||
|
||||
if ((Input.GetKeyDown(KeyCode.E) || Input.GetKeyDown(KeyCode.JoystickButton2)) && pStats.HasGrapple) //If grapple button is hit
|
||||
{
|
||||
@@ -64,23 +72,29 @@ public class GrapplingHook : NetworkBehaviour
|
||||
if (hookPointIndex != -1) //If there is a hookpoint
|
||||
{
|
||||
hookPoint = hookPoints[hookPointIndex]; //The point we are grappling from
|
||||
ropeLength = Vector3.Distance(gameObject.transform.position, hookPoint.transform.position) + 0.5f;
|
||||
ropeLength = Vector3.Distance(gameObject.transform.position, hookPoint.transform.position);
|
||||
oldXZDir = (new Vector3(hookPoint.transform.position.x,0,hookPoint.transform.position.z) - new Vector3(transform.position.x,0,transform.position.z)).normalized;
|
||||
curXZDir = (new Vector3(hookPoint.transform.position.x,0,hookPoint.transform.position.z) - new Vector3(transform.position.x,0,transform.position.z)).normalized;
|
||||
swingMom = CalculateSwingMom(playerMovement.driftVel.magnitude * 50f);
|
||||
oldSwingMom = swingMom;
|
||||
playerMovement.g = -1;
|
||||
isGrappled = true; //toggle grappling state
|
||||
release = false;
|
||||
lerpRelease = Vector3.zero;
|
||||
}
|
||||
}
|
||||
else //Else we are grappling
|
||||
{
|
||||
isGrappled = false; //toggle grappling state to release
|
||||
release = true;
|
||||
playerMovement.g = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void FixedUpdate()
|
||||
{
|
||||
if (!IsLocalPlayer) { return; }
|
||||
|
||||
//if (!IsLocalPlayer) { return; }
|
||||
if (isGrappled)
|
||||
{
|
||||
Debug.DrawRay(gameObject.transform.position, (hookPoint.transform.position - gameObject.transform.position)); //Visual of line
|
||||
@@ -111,31 +125,53 @@ public class GrapplingHook : NetworkBehaviour
|
||||
if (Vector3.Distance(gameObject.transform.position, hookPoint.transform.position) >= ropeLength )
|
||||
{
|
||||
|
||||
forceDirection = calculateForceDirection(1, playerMovement.g+.01f, hookPoint.transform.position);
|
||||
forceDirection = CalculateForceDirection(1, playerMovement.g, hookPoint.transform.position) + RopeLengthOffset(hookPoint.transform.position, Vector3.Distance(gameObject.transform.position, hookPoint.transform.position));
|
||||
|
||||
|
||||
}
|
||||
else{
|
||||
forceDirection = Vector3.zero;
|
||||
}
|
||||
|
||||
//apply special swing movement when aerial
|
||||
if(!playerMovement.isGrounded){
|
||||
movementController.Move(swingMoveController());
|
||||
movementController.Move(SwingMoveController());
|
||||
if(swingMom != 0){
|
||||
movementController.Move(calculateMomentumDirection(playerMovement.g, hookPoint.transform.position));
|
||||
movementController.Move(CalculateMomentumDirection(playerMovement.g, hookPoint.transform.position));
|
||||
swingMom -= .5f;
|
||||
}
|
||||
}
|
||||
else{
|
||||
swingMom = CalculateSwingMom(playerMovement.driftVel.magnitude * 50f);
|
||||
}
|
||||
|
||||
if(swingMom<0) swingMom = 0;
|
||||
|
||||
tempRelease = CalculateSwingReleaseForce();
|
||||
}
|
||||
else if(!isGrappled || playerMovement.isGrounded){
|
||||
flip = -1;
|
||||
else if(!isGrappled){
|
||||
//Reset force direction after unhook
|
||||
forceDirection = Vector3.zero;
|
||||
swingback = true;
|
||||
swingMom = 50;
|
||||
|
||||
if(release){
|
||||
lerpRelease = Vector3.Lerp(lerpRelease, tempRelease, 10 * Time.deltaTime);
|
||||
movementController.Move(lerpRelease);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
//WILL NEED ADJUSTMENT OR REMOVAL IN THE FUTURE
|
||||
//ungrapple on jump
|
||||
if(playerMovement.GetJumpPressed()) isGrappled = false;
|
||||
|
||||
//Reset force direction after unhook
|
||||
if(isGrappled == false) forceDirection = Vector3.zero;
|
||||
if(playerMovement.GetJumpPressed() && !playerMovement.isGrounded && isGrappled){
|
||||
release = true;
|
||||
isGrappled = false;
|
||||
}
|
||||
if(playerMovement.isGrounded){
|
||||
swingback = true;
|
||||
release = false;
|
||||
}
|
||||
}
|
||||
|
||||
//Finds the nearest hook to the player
|
||||
@@ -154,8 +190,17 @@ public class GrapplingHook : NetworkBehaviour
|
||||
return index;
|
||||
}
|
||||
|
||||
//Needs to be Overhauled to properly implement energy loss taking into account players current Velocity, height and input
|
||||
//------Important Equations--------
|
||||
// TensionForce = Cos(theta) * g * m * Vector3(tensionDirection)
|
||||
// Potential Energy = m * g * h -- Will need to modify adding current speed
|
||||
// Kinetic Energy = 1/2 * m * V^2 -- assuming no energy loss at the bottom KE = PE at peak we will add energy loss ourselves
|
||||
// Total Energy = m * ((g*h) + (1/2 * V^2))
|
||||
// Velocity = (2 * ((TotalEnergy/m) - (g*h)))^(1/2) -- This hypothetically could be used for our swing momentum calculation
|
||||
// Movement Direction right angle of tension force = Sin(theta) * g * m * Vector3(Right angle to tensionDirection)
|
||||
|
||||
//Calculate the tether direction vector and how much force that vector needs
|
||||
Vector3 calculateForceDirection(float mass, float g, Vector3 hPoint){
|
||||
Vector3 CalculateForceDirection(float mass, float g, Vector3 hPoint){
|
||||
|
||||
//tension direction and angle calculation
|
||||
tensionDirection = (hPoint - transform.position).normalized;
|
||||
@@ -171,33 +216,48 @@ public class GrapplingHook : NetworkBehaviour
|
||||
return fDirection;
|
||||
}
|
||||
|
||||
Vector3 calculateMomentumDirection(float g, Vector3 hPoint){
|
||||
Vector3 CalculateMomentumDirection(float g, Vector3 hPoint){
|
||||
|
||||
tensionMomDirection = (hPoint - transform.position).normalized;
|
||||
hookPointRight = Vector3.Cross((new Vector3(hPoint.x,0,hPoint.z) - new Vector3(transform.position.x,0,transform.position.z)), transform.up).normalized;
|
||||
momDirection = flip * Vector3.Cross(hookPointRight, tensionMomDirection).normalized;
|
||||
hookPointRight = Vector3.Cross(oldXZDir, transform.up).normalized;
|
||||
momDirection = -1 * Vector3.Cross(hookPointRight, tensionMomDirection).normalized;
|
||||
|
||||
if(oldXZDir != curXZDir && flip == -1){
|
||||
flip = 1;
|
||||
midpointMom = swingMom;
|
||||
if(oldXZDir != curXZDir){
|
||||
//midpointMom = swingMom;
|
||||
swingback = false;
|
||||
Debug.Log("flip");
|
||||
//Debug.Log("flip");
|
||||
}
|
||||
|
||||
if(swingback == false && swingMom <= (midpointMom*(.75f))){
|
||||
if(swingback == false && swingMom <= (oldSwingMom*(.75f))){
|
||||
swingback = true;
|
||||
flip = -1;
|
||||
oldSwingMom = swingMom;
|
||||
oldXZDir = (new Vector3(hookPoint.transform.position.x,0,hookPoint.transform.position.z) - new Vector3(transform.position.x,0,transform.position.z)).normalized;
|
||||
Debug.Log("swingback");
|
||||
//Debug.Log("swingback");
|
||||
}
|
||||
|
||||
curXZDir = (new Vector3(hPoint.x,0,hPoint.z) - new Vector3(transform.position.x,0,transform.position.z)).normalized;
|
||||
Debug.DrawRay(transform.position, momDirection * Time.deltaTime* 100, Color.green);
|
||||
return (momDirection * Time.deltaTime * swingMom);
|
||||
}
|
||||
|
||||
//Calculates the players initial swing momentum using their height and their current velocity
|
||||
float CalculateSwingMom(float playerSpeed){
|
||||
|
||||
//Calculate the players height compared to the lowest point in the swing
|
||||
float swingHeight = transform.position.y - (hookPoint.transform.position.y - ropeLength);
|
||||
if(swingHeight <= 1){
|
||||
swingHeight = 1;
|
||||
}
|
||||
|
||||
float sMom = playerSpeed + (swingHeight*2);
|
||||
if(sMom > maxSwingMom){
|
||||
sMom = maxSwingMom;
|
||||
}
|
||||
return sMom;
|
||||
}
|
||||
|
||||
//Special movement for the player while they swing
|
||||
Vector3 swingMoveController(){
|
||||
Vector3 SwingMoveController(){
|
||||
|
||||
//WASD input
|
||||
float inputVert = Input.GetAxis("Vertical");
|
||||
@@ -207,14 +267,49 @@ public class GrapplingHook : NetworkBehaviour
|
||||
if((!Input.GetKey(KeyCode.W) && !Input.GetKey(KeyCode.S))) inputVert = 0;
|
||||
if((!Input.GetKey(KeyCode.A) && !Input.GetKey(KeyCode.D))) inputHor = 0;
|
||||
|
||||
//Swingspeed build up
|
||||
if((inputVert != 0 || inputHor != 0) && swingSpeed < maxSwingSpeed){
|
||||
swingSpeed += swingAcc;
|
||||
}
|
||||
else if((inputVert != 0 || inputHor != 0) && swingSpeed >= maxSwingSpeed){
|
||||
swingSpeed = maxSwingSpeed;
|
||||
}
|
||||
else if((inputVert == 0 && inputHor == 0)){
|
||||
swingSpeed = minSwingSpeed;
|
||||
}
|
||||
|
||||
//Swing direction based on player input
|
||||
swingDirection = Vector3.Cross(tensionDirection, ((transform.right * -inputVert) + (transform.forward * inputHor))).normalized;
|
||||
|
||||
|
||||
//NEED TO ADD SWINGSPEED EASING
|
||||
//this could be just adding a gradual increase in the swing speed instead of using a flat rate
|
||||
//Swing movement with swing speed added
|
||||
Vector3 swingMovement = (swingDirection * Time.deltaTime * maxSwingSpeed);
|
||||
Vector3 swingMovement = (swingDirection * Time.deltaTime * swingSpeed);
|
||||
|
||||
|
||||
return (swingMovement);
|
||||
}
|
||||
|
||||
Vector3 RopeLengthOffset(Vector3 hPoint, float curDistance){
|
||||
|
||||
//How powerful our offset movement has to be
|
||||
float offsetPower = ((curDistance - ropeLength) * 200f);
|
||||
|
||||
//The direction we need to apply force to offset when the rope gets lengthened beyond the necessary point
|
||||
Vector3 tenDirOffset = (hPoint - transform.position).normalized;
|
||||
|
||||
|
||||
return tenDirOffset * offsetPower * Time.deltaTime;
|
||||
}
|
||||
|
||||
Vector3 CalculateSwingReleaseForce(){
|
||||
Vector3 releaseSwingForceDirection = momDirection * (swingMom + 20);
|
||||
releaseSwingForceDirection = new Vector3(releaseSwingForceDirection.x,0,releaseSwingForceDirection.z);
|
||||
|
||||
if(swingMom < 5){
|
||||
return Vector3.zero;
|
||||
}
|
||||
return releaseSwingForceDirection * Time.deltaTime;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,9 @@ public class Nitro : MonoBehaviour
|
||||
private PlayerStats playerStats;
|
||||
public SpecialItem nitroItem;
|
||||
private bool isOnCoolDown = false;
|
||||
public bool isNitroing = false;
|
||||
|
||||
private float tempTimer = 5;
|
||||
//this will need to be set from scritable object or something;
|
||||
|
||||
// Start is called before the first frame update
|
||||
@@ -23,16 +26,40 @@ public class Nitro : MonoBehaviour
|
||||
//once cooldowns are implemented, put this on one (a long one)
|
||||
if (Input.GetKeyDown(KeyCode.LeftShift) && isOnCoolDown == false && playerStats.HasNitro)
|
||||
{
|
||||
playerStats.CurVel = playerStats.MaxVel;
|
||||
StartCoroutine(startCoolDown());
|
||||
isNitroing = true;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void FixedUpdate(){
|
||||
if(isNitroing){
|
||||
if(tempTimer > 0){
|
||||
|
||||
tempTimer -= .01f;
|
||||
|
||||
Debug.Log("nitro is on");
|
||||
|
||||
if(playerStats.CurVel < playerStats.HardCapMaxVel){
|
||||
playerStats.CurVel += playerStats.Acc * 10;
|
||||
}
|
||||
else if(playerStats.CurVel > playerStats.HardCapMaxVel){
|
||||
playerStats.CurVel = playerStats.HardCapMaxVel;
|
||||
}
|
||||
}
|
||||
else{
|
||||
StartCoroutine(startCoolDown());
|
||||
isNitroing = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private IEnumerator startCoolDown(){
|
||||
Debug.Log("start corotine");
|
||||
isOnCoolDown = true;
|
||||
driver.startUICooldown("Nitro");
|
||||
//driver.startUICooldown("Nitro");
|
||||
yield return new WaitForSeconds(nitroItem.cooldownM);
|
||||
isOnCoolDown = false;
|
||||
tempTimer = 5;
|
||||
Debug.Log("end corotine");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -94,6 +94,9 @@ public class PlayerMovement : NetworkBehaviour
|
||||
|
||||
//Grapple
|
||||
private GrapplingHook grapple;
|
||||
|
||||
//Nitro
|
||||
private Nitro nitro;
|
||||
|
||||
|
||||
//Animation controller
|
||||
@@ -114,6 +117,7 @@ public class PlayerMovement : NetworkBehaviour
|
||||
wallRun = GetComponent<WallRun>(); //Wallrun
|
||||
blink = GetComponent<Blink>(); //Blink
|
||||
grapple = GetComponent<GrapplingHook>();
|
||||
nitro = GetComponent<Nitro>();
|
||||
|
||||
//Get parents up direction
|
||||
up = GetComponentInParent<Transform>().up;
|
||||
@@ -220,6 +224,7 @@ public class PlayerMovement : NetworkBehaviour
|
||||
}
|
||||
//Move Player
|
||||
if(grapple.isGrappled && !isGrounded){
|
||||
driftVel = Vector3.zero;
|
||||
moveController.Move(((moveY + grapple.forceDirection) * Time.deltaTime));
|
||||
}
|
||||
else{
|
||||
@@ -236,7 +241,7 @@ public class PlayerMovement : NetworkBehaviour
|
||||
{
|
||||
WallCheck();
|
||||
//If nothing is pressed speed is 0
|
||||
if ((Input.GetAxis("Vertical") == 0.0f && Input.GetAxis("Horizontal") == 0.0f) || isSliding ||(grapple.isGrappled && !isGrounded))
|
||||
if ((Input.GetAxis("Vertical") == 0.0f && Input.GetAxis("Horizontal") == 0.0f) || isSliding || (grapple.isGrappled && !isGrounded))
|
||||
{
|
||||
pStats.CurVel = 0.0f;
|
||||
return pStats.CurVel;
|
||||
@@ -254,10 +259,18 @@ public class PlayerMovement : NetworkBehaviour
|
||||
return pStats.CurVel;
|
||||
}
|
||||
//If the players speed is above or equal to max speed set speed to max
|
||||
else
|
||||
else if (pStats.CurVel >= pStats.MaxVel && nitro.isNitroing == false)
|
||||
{
|
||||
pStats.CurVel = pStats.MaxVel;
|
||||
return pStats.CurVel;
|
||||
|
||||
}
|
||||
else if(nitro.isNitroing){
|
||||
return pStats.CurVel;
|
||||
}
|
||||
else{
|
||||
Debug.Log("Something has gone wrong with the PlayerSpeed()");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -288,6 +301,7 @@ public class PlayerMovement : NetworkBehaviour
|
||||
if(wallRun.IsWallRunning()){
|
||||
AddImpact((wallRun.GetWallJumpDirection()), pStats.JumpPow * 8.5f);
|
||||
g = pStats.JumpPow;
|
||||
curJumpNum = 0;
|
||||
}
|
||||
|
||||
else{
|
||||
@@ -390,6 +404,7 @@ public class PlayerMovement : NetworkBehaviour
|
||||
}
|
||||
|
||||
|
||||
|
||||
//REMOVE WHEN UNNECCESARY
|
||||
//Respawns player if they fall below a certain point
|
||||
private void Respawn()
|
||||
|
||||
Reference in New Issue
Block a user