Updated player prefabs and non debug scripts

I did remember to uncomment if(!isLocalPlayer) thing
This commit is contained in:
Melbyj1125
2022-02-07 08:24:07 -06:00
parent 574b1d9431
commit df02d905b3
8 changed files with 46 additions and 31 deletions

View File

@@ -89,9 +89,6 @@ public class dPlayerMovement : NetworkBehaviour
private bool qDown;
private float tempCurVel;
//Blink
private dBlink blink;
//Grapple
private dGrapplingHook grapple;
@@ -115,7 +112,6 @@ public class dPlayerMovement : NetworkBehaviour
//Initialize Scripts
pStats = GetComponent<PlayerStats>(); // PlayerStats
wallRun = GetComponent<dWallRun>(); //Wallrun
blink = GetComponent<dBlink>(); //Blink
grapple = GetComponent<dGrapplingHook>();
nitro = GetComponent<dNitro>();

View File

@@ -5,7 +5,8 @@ using UnityEngine;
public class GrapplingHook : NetworkBehaviour
{
public float maxGrappleDistance = 15;
public float maxGrappleDistance = 20;
public float maxGrabDistance = 30;
public bool isGrappled;
private int hookPointIndex;
@@ -73,8 +74,13 @@ public class GrapplingHook : NetworkBehaviour
{
hookPoint = hookPoints[hookPointIndex]; //The point we are grappling from
ropeLength = Vector3.Distance(gameObject.transform.position, hookPoint.transform.position);
if(ropeLength > maxGrappleDistance){
ropeLength = maxGrappleDistance;
}
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;
@@ -114,9 +120,9 @@ public class GrapplingHook : NetworkBehaviour
if (Input.GetKey(KeyCode.RightShift) || Input.GetKey(KeyCode.JoystickButton5))
{
ropeLength -= climbRate * Time.deltaTime;
if (ropeLength < 5)
if (ropeLength < 8)
{
ropeLength = 5;
ropeLength = 8;
}
//Debug.Log(ropeLength.ToString());
}
@@ -124,7 +130,7 @@ public class GrapplingHook : NetworkBehaviour
//Calculate tether force direction based on hookpoint
if (Vector3.Distance(gameObject.transform.position, hookPoint.transform.position) >= ropeLength )
{
Debug.Log(ropeLength);
forceDirection = CalculateForceDirection(1, playerMovement.g, hookPoint.transform.position) + RopeLengthOffset(hookPoint.transform.position, Vector3.Distance(gameObject.transform.position, hookPoint.transform.position));
@@ -155,7 +161,9 @@ public class GrapplingHook : NetworkBehaviour
swingback = true;
if(release){
lerpRelease = Vector3.Lerp(lerpRelease, tempRelease, 10 * Time.deltaTime);
lerpRelease = Vector3.Lerp(lerpRelease, tempRelease, 10f * Time.deltaTime);
tempRelease *= .99f;
Debug.Log(lerpRelease);
movementController.Move(lerpRelease);
}
@@ -177,7 +185,7 @@ public class GrapplingHook : NetworkBehaviour
//Finds the nearest hook to the player
int FindHookPoint()
{
float least = maxGrappleDistance;
float least = maxGrabDistance;
int index = -1;
for(int i = 0; i<hookPoints.Length; i++)
{
@@ -304,7 +312,9 @@ public class GrapplingHook : NetworkBehaviour
}
Vector3 CalculateSwingReleaseForce(){
Vector3 releaseSwingForceDirection = momDirection * (swingMom + 20);
Vector3 releaseSwingForceDirection = momDirection * ((swingMom) + 10);
releaseSwingForceDirection = new Vector3(releaseSwingForceDirection.x,0,releaseSwingForceDirection.z);
if(swingMom < 5){

View File

@@ -89,9 +89,6 @@ public class PlayerMovement : NetworkBehaviour
private bool qDown;
private float tempCurVel;
//Blink
private Blink blink;
//Grapple
private GrapplingHook grapple;
@@ -115,7 +112,6 @@ public class PlayerMovement : NetworkBehaviour
//Initialize Scripts
pStats = GetComponent<PlayerStats>(); // PlayerStats
wallRun = GetComponent<WallRun>(); //Wallrun
blink = GetComponent<Blink>(); //Blink
grapple = GetComponent<GrapplingHook>();
nitro = GetComponent<Nitro>();
@@ -568,9 +564,10 @@ public class PlayerMovement : NetworkBehaviour
//Slide Function
private void Slide(){
//if the q button or the east face button on gamepad is held down
if (Input.GetKey(KeyCode.JoystickButton1) || Input.GetKey(KeyCode.Q)) {
if ((Input.GetKey(KeyCode.JoystickButton1) || Input.GetKey(KeyCode.Q))) {
qDown = true;
if (isSliding == false){
originalTraction = pStats.Traction;
this.gameObject.transform.eulerAngles = new Vector3(this.transform.eulerAngles.x - 90, this.transform.eulerAngles.y, this.transform.eulerAngles.z);
isSliding = true;