mirror of
https://github.com/Leahnaya/TheKingsRace.git
synced 2026-04-26 02:00:54 -05:00
A lot of cleanup and adjustments
traction resets after a glide Keep Momentum after sliding Wallrun adjusted on player prefab Wallrun added to Player prefab2 A lot of stats adjusted on all prefabs
This commit is contained in:
parent
bb5ee9d2b2
commit
79626242c0
|
|
@ -3544,11 +3544,11 @@ MonoBehaviour:
|
|||
maxVel: 40
|
||||
minVel: 20
|
||||
curVel: 0
|
||||
acc: 0.01
|
||||
acc: 0.02
|
||||
jumpPow: 60
|
||||
jumpNum: 2
|
||||
traction: 3
|
||||
kickPow: 150
|
||||
kickPow: 500
|
||||
recovTime: 3
|
||||
playerGrav: 200
|
||||
hasBlink: 0
|
||||
|
|
@ -3684,8 +3684,8 @@ MonoBehaviour:
|
|||
vel: {x: 0, y: 0, z: 0}
|
||||
driftVel: {x: 0, y: 0, z: 0}
|
||||
curJumpNum: 0
|
||||
lowJumpMultiplier: 0.3
|
||||
fallMultiplier: 1.5
|
||||
lowJumpMultiplier: 0.1
|
||||
fallMultiplier: 1.6
|
||||
g: 0
|
||||
isGrounded: 0
|
||||
groundCheckDistance: 0.05
|
||||
|
|
@ -3752,7 +3752,7 @@ MonoBehaviour:
|
|||
m_Script: {fileID: 11500000, guid: f4264f4f7bed1d7499a037436582ed17, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
wallMaxDistance: 0.8
|
||||
wallMaxDistance: 3
|
||||
wallSpeedMultiplier: 1.2
|
||||
minimumHeight: 0.1
|
||||
maxAngleRoll: 20
|
||||
|
|
|
|||
|
|
@ -299,7 +299,7 @@ MonoBehaviour:
|
|||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
maxVel: 40
|
||||
minVel: 15
|
||||
minVel: 20
|
||||
curVel: 0
|
||||
acc: 0.01
|
||||
jumpPow: 60
|
||||
|
|
|
|||
|
|
@ -201,6 +201,7 @@ GameObject:
|
|||
- component: {fileID: 643107261017207495}
|
||||
- component: {fileID: 643107261017207494}
|
||||
- component: {fileID: 643107261017207493}
|
||||
- component: {fileID: 3000149458743537421}
|
||||
m_Layer: 0
|
||||
m_Name: T-Pose
|
||||
m_TagString: Player
|
||||
|
|
@ -263,7 +264,7 @@ MonoBehaviour:
|
|||
jumpPow: 60
|
||||
jumpNum: 2
|
||||
traction: 3
|
||||
kickPow: 150
|
||||
kickPow: 500
|
||||
recovTime: 3
|
||||
playerGrav: 200
|
||||
hasBlink: 0
|
||||
|
|
@ -399,8 +400,8 @@ MonoBehaviour:
|
|||
vel: {x: 0, y: 0, z: 0}
|
||||
driftVel: {x: 0, y: 0, z: 0}
|
||||
curJumpNum: 0
|
||||
lowJumpMultiplier: 0.3
|
||||
fallMultiplier: 1.5
|
||||
lowJumpMultiplier: 0.1
|
||||
fallMultiplier: 1.6
|
||||
g: 0
|
||||
isGrounded: 0
|
||||
groundCheckDistance: 0.05
|
||||
|
|
@ -424,6 +425,7 @@ MonoBehaviour:
|
|||
maxGrappleDistance: 25
|
||||
isGrappled: 0
|
||||
ropeLength: 0
|
||||
forceDirection: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &643107261017207494
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
@ -454,6 +456,27 @@ MonoBehaviour:
|
|||
dashDistance: 10
|
||||
dashStoppingSpeed: 0.1
|
||||
dashItem: {fileID: 11400000, guid: 4399d7276b3edf446ac51c5145539a5e, type: 2}
|
||||
--- !u!114 &3000149458743537421
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 643107261017207491}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 535009eaa735a4c4e95c6fc270e32741, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
wallMaxDistance: 3
|
||||
wallSpeedMultiplier: 1.2
|
||||
minimumHeight: 0.1
|
||||
maxAngleRoll: 20
|
||||
normalizedAngleThreshold: 0.1
|
||||
jumpDuration: 0.02
|
||||
wallBouncing: 3
|
||||
cameraTransitionDuration: 1
|
||||
wallGravityDownForce: 5
|
||||
--- !u!1 &695157680752675209
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
|
|||
|
|
@ -154,8 +154,8 @@ MonoBehaviour:
|
|||
vel: {x: 0, y: 0, z: 0}
|
||||
driftVel: {x: 0, y: 0, z: 0}
|
||||
curJumpNum: 0
|
||||
lowJumpMultiplier: 0.3
|
||||
fallMultiplier: 1.5
|
||||
lowJumpMultiplier: 0.1
|
||||
fallMultiplier: 1.6
|
||||
g: 0
|
||||
isGrounded: 0
|
||||
groundCheckDistance: 0.05
|
||||
|
|
@ -189,15 +189,15 @@ MonoBehaviour:
|
|||
m_Script: {fileID: 11500000, guid: 535009eaa735a4c4e95c6fc270e32741, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
wallMaxDistance: 1
|
||||
wallMaxDistance: 3
|
||||
wallSpeedMultiplier: 1.2
|
||||
minimumHeight: 1.2
|
||||
minimumHeight: 0.1
|
||||
maxAngleRoll: 20
|
||||
normalizedAngleThreshold: 0.1
|
||||
jumpDuration: 1
|
||||
jumpDuration: 0.02
|
||||
wallBouncing: 3
|
||||
cameraTransitionDuration: 1
|
||||
wallGravityDownForce: 20
|
||||
wallGravityDownForce: 5
|
||||
--- !u!114 &4323471435859684389
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
@ -229,6 +229,7 @@ MonoBehaviour:
|
|||
maxGrappleDistance: 25
|
||||
isGrappled: 0
|
||||
ropeLength: 0
|
||||
forceDirection: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &2356773567935625033
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
|
|||
|
|
@ -1250,10 +1250,22 @@ PrefabInstance:
|
|||
m_Modification:
|
||||
m_TransformParent: {fileID: 0}
|
||||
m_Modifications:
|
||||
- target: {fileID: 1818923263116056088, guid: 362ca97b75c291a47ab81d628a81f440, type: 3}
|
||||
propertyPath: wallMaxDistance
|
||||
value: 3
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 5633209979457551608, guid: 362ca97b75c291a47ab81d628a81f440, type: 3}
|
||||
propertyPath: m_Name
|
||||
value: DebugPlayerPrefab
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6743056025486776975, guid: 362ca97b75c291a47ab81d628a81f440, type: 3}
|
||||
propertyPath: fallMultiplier
|
||||
value: 1.6
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6743056025486776975, guid: 362ca97b75c291a47ab81d628a81f440, type: 3}
|
||||
propertyPath: lowJumpMultiplier
|
||||
value: 0.1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6926740475113451123, guid: 362ca97b75c291a47ab81d628a81f440, type: 3}
|
||||
propertyPath: m_RootOrder
|
||||
value: 4
|
||||
|
|
@ -1300,7 +1312,11 @@ PrefabInstance:
|
|||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8100520363622627413, guid: 362ca97b75c291a47ab81d628a81f440, type: 3}
|
||||
propertyPath: minVel
|
||||
value: 20
|
||||
value: 15
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8100520363622627413, guid: 362ca97b75c291a47ab81d628a81f440, type: 3}
|
||||
propertyPath: hasWallrun
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents: []
|
||||
m_SourcePrefab: {fileID: 100100000, guid: 362ca97b75c291a47ab81d628a81f440, type: 3}
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ public class dGrapplingHook : NetworkBehaviour
|
|||
{
|
||||
//if (!IsLocalPlayer) { return; }
|
||||
|
||||
if (Input.GetKeyDown(KeyCode.E) || Input.GetKeyDown(KeyCode.JoystickButton2)) //If grapple button is hit
|
||||
if ((Input.GetKeyDown(KeyCode.E) || Input.GetKeyDown(KeyCode.JoystickButton2)) && pStats.HasGrapple) //If grapple button is hit
|
||||
{
|
||||
if (!isGrappled) //If we are not grappling
|
||||
{
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ public class dKickController : NetworkBehaviour
|
|||
}
|
||||
|
||||
void Kick(){
|
||||
//if (!IsLocalPlayer) { return; }
|
||||
//Note: when we merge this into PlayerMovement, we may want to change isgrounded to our
|
||||
//custom is grounded
|
||||
//If F is pressed or gamepad right trigger is pulled
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ using UnityEngine.Rendering;
|
|||
public class dWallRun : NetworkBehaviour
|
||||
{
|
||||
|
||||
public float wallMaxDistance = .8f;
|
||||
public float wallMaxDistance = 3f;
|
||||
public float wallSpeedMultiplier = 1.2f;
|
||||
public float minimumHeight = .1f;
|
||||
public float maxAngleRoll = 20;
|
||||
|
|
@ -174,8 +174,8 @@ public class dWallRun : NetworkBehaviour
|
|||
|
||||
playerMovementController.SetPlayerVelocity(moveToSet);
|
||||
isWallRunning = true;
|
||||
if(playerMovementController.curJumpNum != 0){
|
||||
playerMovementController.curJumpNum = 0 ;
|
||||
if(playerMovementController.curJumpNum == playerMovementController.pStats.JumpNum){
|
||||
playerMovementController.curJumpNum = 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ public class dPlayerMovement : NetworkBehaviour
|
|||
//Jump value
|
||||
public int curJumpNum; // current Jumps used
|
||||
private bool jumpHeld; // Is jump being held
|
||||
private bool jumpPressed; // Has Jump been pressed
|
||||
float coyJumpTimer = 0.1f; // Default Coyote Jump time
|
||||
float curCoyJumpTimer; // current Coyote Jump time
|
||||
public float lowJumpMultiplier; // Short jump multiplier
|
||||
|
|
@ -83,6 +84,7 @@ public class dPlayerMovement : NetworkBehaviour
|
|||
private RaycastHit ray;
|
||||
private Vector3 up;
|
||||
private bool qDown;
|
||||
private float tempCurVel;
|
||||
|
||||
//Blink
|
||||
private dBlink blink;
|
||||
|
|
@ -222,6 +224,7 @@ public class dPlayerMovement : NetworkBehaviour
|
|||
//Calculates speed current player needs to be going
|
||||
public float PlayerSpeed()
|
||||
{
|
||||
WallCheck();
|
||||
//If nothing is pressed speed is 0
|
||||
if ((Input.GetAxis("Vertical") == 0.0f && Input.GetAxis("Horizontal") == 0.0f) || isSliding)
|
||||
{
|
||||
|
|
@ -248,7 +251,10 @@ public class dPlayerMovement : NetworkBehaviour
|
|||
}
|
||||
}
|
||||
|
||||
private void WallCheck(){
|
||||
//IMPLEMENT A RAYCAST CHECK
|
||||
|
||||
}
|
||||
|
||||
//Apply Impact for when force needs to be applied without ragdolling
|
||||
public void AddImpact(Vector3 dir, float force)
|
||||
|
|
@ -280,6 +286,7 @@ public class dPlayerMovement : NetworkBehaviour
|
|||
|
||||
curJumpNum++;
|
||||
jumpHeld = true;
|
||||
jumpPressed = true;
|
||||
}
|
||||
|
||||
//Last time Jumped
|
||||
|
|
@ -296,12 +303,16 @@ public class dPlayerMovement : NetworkBehaviour
|
|||
//if jump is being held coyote timer is zero
|
||||
if(jumpHeld) curCoyJumpTimer = 0;
|
||||
|
||||
if(grapple.isGrappled && curJumpNum == 2) curJumpNum = 1;
|
||||
if(grapple.isGrappled && curJumpNum == pStats.JumpNum) curJumpNum = 0;
|
||||
|
||||
//If space/south face gamepad button isn't being pressed then jump is false
|
||||
if (Input.GetAxis("Jump") == 0){
|
||||
jumpHeld = false;
|
||||
}
|
||||
|
||||
if(g < 0){
|
||||
jumpPressed = false;
|
||||
}
|
||||
}
|
||||
|
||||
//Get and update PlayerValues for other scripts
|
||||
|
|
@ -397,6 +408,11 @@ public class dPlayerMovement : NetworkBehaviour
|
|||
tempSet = true;
|
||||
}
|
||||
}
|
||||
//if temporary values have been set restore them back to the normal values
|
||||
else if(pStats.HasGlider && g==0 && tempSet == true){
|
||||
pStats.Traction = tempTraction;
|
||||
tempSet = false;
|
||||
}
|
||||
|
||||
//Wallrunning
|
||||
else if (pStats.HasWallrun) {
|
||||
|
|
@ -414,14 +430,9 @@ public class dPlayerMovement : NetworkBehaviour
|
|||
}
|
||||
}
|
||||
|
||||
//Default Gravity
|
||||
else{
|
||||
|
||||
//if temporary values have been set restore them back to the normal values
|
||||
if(tempSet == true){
|
||||
pStats.Traction = tempTraction;
|
||||
tempSet = false;
|
||||
}
|
||||
|
||||
//Normal gravity
|
||||
GravityCalculation(pStats.PlayerGrav);
|
||||
}
|
||||
|
|
@ -460,7 +471,7 @@ public class dPlayerMovement : NetworkBehaviour
|
|||
isGrounded = false;
|
||||
groundRay = new Ray(moveController.transform.position, Vector3.down);
|
||||
|
||||
if (Physics.Raycast(groundRay, out groundHit, moveController.height + groundCheckDistance) && !jumpHeld ) //&& Time.time >= lastTimeJumped + jumpGroundingPreventionTime) // only try to detect ground if it's been a short amount of time since last jump; otherwise we may snap to the ground instantly after we try jumping
|
||||
if (Physics.Raycast(groundRay, out groundHit, moveController.height + groundCheckDistance) && !jumpPressed ) //&& Time.time >= lastTimeJumped + jumpGroundingPreventionTime) // only try to detect ground if it's been a short amount of time since last jump; otherwise we may snap to the ground instantly after we try jumping
|
||||
{
|
||||
// Only consider this a valid ground hit if the ground normal goes in the same direction as the character up
|
||||
if (Vector3.Dot(groundHit.normal, transform.up) > 0f)
|
||||
|
|
@ -540,6 +551,7 @@ public class dPlayerMovement : NetworkBehaviour
|
|||
pStats.Traction = 0.01f;
|
||||
|
||||
}
|
||||
tempCurVel = driftVel.magnitude * 50f;
|
||||
transform.Rotate(Vector3.forward * -sensitivity * Time.deltaTime * Input.GetAxis("Mouse X"));
|
||||
pStats.Traction += .004f;
|
||||
}
|
||||
|
|
@ -553,6 +565,7 @@ public class dPlayerMovement : NetworkBehaviour
|
|||
{
|
||||
this.gameObject.transform.localEulerAngles = new Vector3(0, 0, 0);
|
||||
isSliding = false;
|
||||
pStats.CurVel = tempCurVel;
|
||||
//if it can't find the animator (capsul prefab)
|
||||
if (GetComponent<Animator>() == null)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ public class KickController : NetworkBehaviour
|
|||
}
|
||||
|
||||
void Kick(){
|
||||
if (!IsLocalPlayer) { return; }
|
||||
//Note: when we merge this into PlayerMovement, we may want to change isgrounded to our
|
||||
//custom is grounded
|
||||
//If F is pressed or gamepad right trigger is pulled
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ using UnityEngine;
|
|||
|
||||
public class GrapplingHook : NetworkBehaviour
|
||||
{
|
||||
public float maxGrappleDistance = 25;
|
||||
public float maxGrappleDistance = 25;
|
||||
|
||||
public bool isGrappled;
|
||||
private int hookPointIndex;
|
||||
|
|
@ -19,6 +19,13 @@ public class GrapplingHook : NetworkBehaviour
|
|||
[SerializeField] private float ropeLength;
|
||||
private float climbRate = 5;
|
||||
|
||||
Vector3 tensionDirection;
|
||||
Vector3 pendulumSideDirection;
|
||||
Vector3 tangentDirection;
|
||||
float tensionForce;
|
||||
public Vector3 forceDirection;
|
||||
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
|
|
@ -33,24 +40,23 @@ public class GrapplingHook : NetworkBehaviour
|
|||
void Update()
|
||||
{
|
||||
if (!IsLocalPlayer) { return; }
|
||||
if(pStats.HasGrapple){
|
||||
if (Input.GetKeyDown(KeyCode.E) || Input.GetKeyDown(KeyCode.JoystickButton2)) //If grapple button is hit
|
||||
|
||||
if ((Input.GetKeyDown(KeyCode.E) || Input.GetKeyDown(KeyCode.JoystickButton2)) && pStats.HasGrapple) //If grapple button is hit
|
||||
{
|
||||
if (!isGrappled) //If we are not grappling
|
||||
{
|
||||
if (!isGrappled) //If we are not grappling
|
||||
hookPointIndex = FindHookPoint(); //Find the nearest hook point within max distance
|
||||
if (hookPointIndex != -1) //If there is a hookpoint
|
||||
{
|
||||
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
|
||||
ropeLength = Vector3.Distance(gameObject.transform.position, hookPoint.transform.position) + 0.5f;
|
||||
isGrappled = true; //toggle grappling state
|
||||
}
|
||||
}
|
||||
else //Else we are grappling
|
||||
{
|
||||
//physics tear down?
|
||||
isGrappled = false; //toggle grappling state to release
|
||||
hookPoint = hookPoints[hookPointIndex]; //The point we are grappling from
|
||||
ropeLength = Vector3.Distance(gameObject.transform.position, hookPoint.transform.position) + 0.5f;
|
||||
isGrappled = true; //toggle grappling state
|
||||
}
|
||||
}
|
||||
else //Else we are grappling
|
||||
{
|
||||
//physics tear down?
|
||||
isGrappled = false; //toggle grappling state to release
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -84,9 +90,7 @@ public class GrapplingHook : NetworkBehaviour
|
|||
if (Vector3.Distance(gameObject.transform.position, hookPoint.transform.position) > ropeLength )
|
||||
{
|
||||
//Impact Based
|
||||
Debug.Log("y");
|
||||
playerMovement.g = 2;
|
||||
movementController.Move((hookPoint.transform.position - gameObject.transform.position) * Time.deltaTime);
|
||||
forceDirection = calculateForceDirection(1, playerMovement.g, hookPoint.transform.position);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -107,60 +111,20 @@ public class GrapplingHook : NetworkBehaviour
|
|||
}
|
||||
return index;
|
||||
}
|
||||
///////////Hookshot Concept
|
||||
// public float maxGrappleDistance = 25;
|
||||
|
||||
// public bool isGrappled;
|
||||
// private Vector3 hookPoint;
|
||||
// private float distance;
|
||||
// public float propelPower = 100;
|
||||
Vector3 calculateForceDirection(float mass, float g, Vector3 hPoint){
|
||||
tensionDirection = (hPoint - transform.position).normalized;
|
||||
Debug.Log(tensionDirection);
|
||||
|
||||
// private CharacterController movementController;
|
||||
// private dPlayerMovement playerMovement;
|
||||
// private PlayerStats pStats;
|
||||
// private Camera cam;
|
||||
// private Vector3 forwardHookLerp;
|
||||
// private Vector3 upwardsHookLerp;
|
||||
float inclinationAngle = Vector3.Angle(transform.position - hPoint, -transform.up);
|
||||
|
||||
// // Start is called before the first frame update
|
||||
// void Start()
|
||||
// {
|
||||
// isGrappled = false;
|
||||
// movementController = gameObject.GetComponent<CharacterController>();
|
||||
// playerMovement = gameObject.GetComponent<dPlayerMovement>();
|
||||
// pStats = gameObject.GetComponent<PlayerStats>();
|
||||
// cam = playerMovement.cam;
|
||||
// }
|
||||
|
||||
// private void FixedUpdate()
|
||||
// {
|
||||
// getGrapplePoint();
|
||||
// //Debug.Log((hookPoint.transform.position - transform.position).normalized);
|
||||
// if (isGrappled && !Input.GetKeyDown(KeyCode.E))
|
||||
// {
|
||||
// //playerMovement.AddImpact((hookPoint - transform.position), propelPower);
|
||||
// forwardHookLerp = Vector3.Lerp(forwardHookLerp, transform.forward * 50, .03f);
|
||||
// movementController.Move(forwardHookLerp * Time.deltaTime);
|
||||
tensionForce = mass * -g * Mathf.Cos(Mathf.Deg2Rad * inclinationAngle);
|
||||
Debug.Log(g);
|
||||
|
||||
// upwardsHookLerp = Vector3.Lerp(upwardsHookLerp, (hookPoint - transform.position).normalized * Vector3.Distance(transform.position, hookPoint) * propelPower, .03f);
|
||||
// movementController.Move(upwardsHookLerp * Time.deltaTime);
|
||||
// isGrappled = false;
|
||||
// }
|
||||
// }
|
||||
|
||||
// private void getGrapplePoint(){
|
||||
// //if E or left face gamepad button is pressed is slightly pressed
|
||||
// if (Input.GetKeyDown(KeyCode.E) || Input.GetKeyDown(KeyCode.JoystickButton2)) //If grapple button is hit
|
||||
// {
|
||||
// if (!isGrappled) //If we are not grappling
|
||||
// {
|
||||
// if(Physics.Raycast(cam.transform.position, cam.transform.forward, out RaycastHit raycastHit)){
|
||||
// if(raycastHit.collider.gameObject.transform.tag == "HookPoint"){
|
||||
// isGrappled = true;
|
||||
// hookPoint = new Vector3 (raycastHit.point.x,raycastHit.point.y,raycastHit.point.z);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
Vector3 fDirection = tensionDirection * tensionForce;
|
||||
Debug.Log(fDirection);
|
||||
return fDirection;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ using UnityEngine.Rendering;
|
|||
public class WallRun : NetworkBehaviour
|
||||
{
|
||||
|
||||
public float wallMaxDistance = 5;
|
||||
public float wallMaxDistance = 3;
|
||||
public float wallSpeedMultiplier = 1.2f;
|
||||
public float minimumHeight = .1f;
|
||||
public float maxAngleRoll = 20;
|
||||
|
|
@ -66,7 +66,7 @@ public class WallRun : NetworkBehaviour
|
|||
|
||||
public void WallRunRoutine()
|
||||
{
|
||||
//if (!IsLocalPlayer) { return; }
|
||||
if (!IsLocalPlayer) { return; }
|
||||
|
||||
isWallRunning = false;
|
||||
|
||||
|
|
@ -174,8 +174,8 @@ public class WallRun : NetworkBehaviour
|
|||
|
||||
playerMovementController.SetPlayerVelocity(moveToSet);
|
||||
isWallRunning = true;
|
||||
if(playerMovementController.curJumpNum != 0){
|
||||
playerMovementController.curJumpNum = 0 ;
|
||||
if(playerMovementController.curJumpNum == playerMovementController.pStats.JumpNum){
|
||||
playerMovementController.curJumpNum = 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ using UnityEngine.UI;
|
|||
|
||||
public class PlayerMovement : NetworkBehaviour
|
||||
{
|
||||
|
||||
//Scripts
|
||||
public PlayerStats pStats;
|
||||
|
||||
|
|
@ -27,6 +28,7 @@ public class PlayerMovement : NetworkBehaviour
|
|||
//Jump value
|
||||
public int curJumpNum; // current Jumps used
|
||||
private bool jumpHeld; // Is jump being held
|
||||
private bool jumpPressed; // Has Jump been pressed
|
||||
float coyJumpTimer = 0.1f; // Default Coyote Jump time
|
||||
float curCoyJumpTimer; // current Coyote Jump time
|
||||
public float lowJumpMultiplier; // Short jump multiplier
|
||||
|
|
@ -82,11 +84,13 @@ public class PlayerMovement : NetworkBehaviour
|
|||
private RaycastHit ray;
|
||||
private Vector3 up;
|
||||
private bool qDown;
|
||||
private float tempCurVel;
|
||||
|
||||
//Blink
|
||||
private Blink blink;
|
||||
|
||||
private GrapplingHook grapple;
|
||||
|
||||
|
||||
//Animation controller
|
||||
Animator animator;
|
||||
|
|
@ -210,9 +214,9 @@ public class PlayerMovement : NetworkBehaviour
|
|||
driftVel = Vector3.zero;
|
||||
if(animator != null) animator.SetBool("isRunning", false);
|
||||
}
|
||||
|
||||
//Move Player
|
||||
moveController.Move(driftVel + (moveY * Time.deltaTime));
|
||||
if(grapple.isGrappled) moveController.Move(grapple.forceDirection * Time.deltaTime);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -220,6 +224,7 @@ public class PlayerMovement : NetworkBehaviour
|
|||
//Calculates speed current player needs to be going
|
||||
public float PlayerSpeed()
|
||||
{
|
||||
WallCheck();
|
||||
//If nothing is pressed speed is 0
|
||||
if ((Input.GetAxis("Vertical") == 0.0f && Input.GetAxis("Horizontal") == 0.0f) || isSliding)
|
||||
{
|
||||
|
|
@ -246,7 +251,10 @@ public class PlayerMovement : NetworkBehaviour
|
|||
}
|
||||
}
|
||||
|
||||
private void WallCheck(){
|
||||
//IMPLEMENT A RAYCAST CHECK
|
||||
|
||||
}
|
||||
|
||||
//Apply Impact for when force needs to be applied without ragdolling
|
||||
public void AddImpact(Vector3 dir, float force)
|
||||
|
|
@ -278,6 +286,7 @@ public class PlayerMovement : NetworkBehaviour
|
|||
|
||||
curJumpNum++;
|
||||
jumpHeld = true;
|
||||
jumpPressed = true;
|
||||
}
|
||||
|
||||
//Last time Jumped
|
||||
|
|
@ -294,12 +303,16 @@ public class PlayerMovement : NetworkBehaviour
|
|||
//if jump is being held coyote timer is zero
|
||||
if(jumpHeld) curCoyJumpTimer = 0;
|
||||
|
||||
if(grapple.isGrappled && curJumpNum == 2) curJumpNum = 1;
|
||||
if(grapple.isGrappled && curJumpNum == pStats.JumpNum) curJumpNum = 0;
|
||||
|
||||
//If space/south face gamepad button isn't being pressed then jump is false
|
||||
if (Input.GetAxis("Jump") == 0){
|
||||
jumpHeld = false;
|
||||
}
|
||||
|
||||
if(g < 0){
|
||||
jumpPressed = false;
|
||||
}
|
||||
}
|
||||
|
||||
//Get and update PlayerValues for other scripts
|
||||
|
|
@ -395,6 +408,11 @@ public class PlayerMovement : NetworkBehaviour
|
|||
tempSet = true;
|
||||
}
|
||||
}
|
||||
//if temporary values have been set restore them back to the normal values
|
||||
else if(pStats.HasGlider && g==0 && tempSet == true){
|
||||
pStats.Traction = tempTraction;
|
||||
tempSet = false;
|
||||
}
|
||||
|
||||
//Wallrunning
|
||||
else if (pStats.HasWallrun) {
|
||||
|
|
@ -412,14 +430,9 @@ public class PlayerMovement : NetworkBehaviour
|
|||
}
|
||||
}
|
||||
|
||||
//Default Gravity
|
||||
else{
|
||||
|
||||
//if temporary values have been set restore them back to the normal values
|
||||
if(tempSet == true){
|
||||
pStats.Traction = tempTraction;
|
||||
tempSet = false;
|
||||
}
|
||||
|
||||
//Normal gravity
|
||||
GravityCalculation(pStats.PlayerGrav);
|
||||
}
|
||||
|
|
@ -438,7 +451,7 @@ public class PlayerMovement : NetworkBehaviour
|
|||
}
|
||||
|
||||
//apply gravity if not grounded and coyote timer is less than 0
|
||||
if(isGrounded == false && curCoyJumpTimer <= 0){
|
||||
if((isGrounded == false && curCoyJumpTimer <= 0) || grapple.isGrappled){
|
||||
g -= grav * Time.deltaTime;
|
||||
}
|
||||
//else don't apply gravity
|
||||
|
|
@ -458,7 +471,7 @@ public class PlayerMovement : NetworkBehaviour
|
|||
isGrounded = false;
|
||||
groundRay = new Ray(moveController.transform.position, Vector3.down);
|
||||
|
||||
if (Physics.Raycast(groundRay, out groundHit, moveController.height + groundCheckDistance) && !jumpHeld ) //&& Time.time >= lastTimeJumped + jumpGroundingPreventionTime) // only try to detect ground if it's been a short amount of time since last jump; otherwise we may snap to the ground instantly after we try jumping
|
||||
if (Physics.Raycast(groundRay, out groundHit, moveController.height + groundCheckDistance) && !jumpPressed ) //&& Time.time >= lastTimeJumped + jumpGroundingPreventionTime) // only try to detect ground if it's been a short amount of time since last jump; otherwise we may snap to the ground instantly after we try jumping
|
||||
{
|
||||
// Only consider this a valid ground hit if the ground normal goes in the same direction as the character up
|
||||
if (Vector3.Dot(groundHit.normal, transform.up) > 0f)
|
||||
|
|
@ -517,47 +530,42 @@ public class PlayerMovement : NetworkBehaviour
|
|||
|
||||
return ragTime;
|
||||
}
|
||||
|
||||
|
||||
//Slide Function
|
||||
private void Slide()
|
||||
{
|
||||
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)
|
||||
{
|
||||
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;
|
||||
//if it can't find the animator (capsul prefab)
|
||||
if (GetComponent<Animator>() == null)
|
||||
{
|
||||
if (GetComponent<Animator>() == null){
|
||||
moveController.height = 1.0f;
|
||||
}
|
||||
//if the regular model
|
||||
else
|
||||
{
|
||||
else {
|
||||
moveController.height *= .5f;
|
||||
}
|
||||
pStats.Traction = 0.01f;
|
||||
|
||||
|
||||
}
|
||||
tempCurVel = driftVel.magnitude * 50f;
|
||||
transform.Rotate(Vector3.forward * -sensitivity * Time.deltaTime * Input.GetAxis("Mouse X"));
|
||||
pStats.Traction += .004f;
|
||||
}
|
||||
else
|
||||
{
|
||||
else{
|
||||
qDown = false;
|
||||
}
|
||||
//NOTE: potentialy change this to only allow player back up if there is nothing above them
|
||||
if (qDown == false && isSliding == true)
|
||||
{
|
||||
if (qDown == false && isSliding == true) {
|
||||
//if nothing is above the object, stop sliding
|
||||
if (Physics.Raycast(this.gameObject.transform.position, up, out ray, 5f) == false)
|
||||
{
|
||||
this.gameObject.transform.localEulerAngles = new Vector3(0, 0, 0);
|
||||
isSliding = false;
|
||||
pStats.CurVel = tempCurVel;
|
||||
//if it can't find the animator (capsul prefab)
|
||||
if (GetComponent<Animator>() == null)
|
||||
{
|
||||
|
|
@ -570,10 +578,9 @@ public class PlayerMovement : NetworkBehaviour
|
|||
}
|
||||
pStats.Traction = originalTraction;
|
||||
}
|
||||
else
|
||||
{
|
||||
else{
|
||||
Debug.Log("Object above you");
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,42 +6,14 @@ EditorUserSettings:
|
|||
serializedVersion: 4
|
||||
m_ConfigSettings:
|
||||
RecentlyUsedScenePath-0:
|
||||
value: 22424703114646680e0b0227036c7b151b180b650d262f3d192c0e27d1e33136e7a923e7ee2e26
|
||||
flags: 0
|
||||
RecentlyUsedScenePath-1:
|
||||
<<<<<<< HEAD
|
||||
value: 22424703114646680e0b0227036c6f02131b172b282d347e38271427fb
|
||||
=======
|
||||
value: 22424703114646680e0b0227036c7b151b180b6519016b0515163936efef2776f7e93ffdfe
|
||||
>>>>>>> MelbyFinalSprint
|
||||
flags: 0
|
||||
RecentlyUsedScenePath-2:
|
||||
value: 22424703114646680e0b0227036c731f1415016439262f2434
|
||||
flags: 0
|
||||
RecentlyUsedScenePath-3:
|
||||
value: 22424703114646680e0b0227036c7b151b180b65072128370c2b143febf4312bd6e225fda92f31352d1b
|
||||
RecentlyUsedScenePath-1:
|
||||
value: 22424703114646680e0b0227036c6f02131b172b282d347e38271427fb
|
||||
flags: 0
|
||||
RecentlyUsedScenePath-4:
|
||||
value: 22424703114646680e0b0227036c7b151b180b652b3a27292f260573f1e33136e7a923e7ee2e26
|
||||
flags: 0
|
||||
RecentlyUsedScenePath-5:
|
||||
RecentlyUsedScenePath-2:
|
||||
value: 22424703114646680e0b0227036c7b151b180b6501273035202c1327d1e33136e7a923e7ee2e26
|
||||
flags: 0
|
||||
RecentlyUsedScenePath-6:
|
||||
value: 22424703114646680e0b0227036c78111b125507233d28242c201373b3ae2136ebf32f
|
||||
flags: 0
|
||||
RecentlyUsedScenePath-7:
|
||||
value: 22424703114646680e0b0227036c7b151b180b650721283704240d14e3f93637faa923e7ee2e26
|
||||
flags: 0
|
||||
RecentlyUsedScenePath-8:
|
||||
value: 22424703114646680e0b0227036c7b151b180b650721283704240d7df7ee3d2cfb
|
||||
flags: 0
|
||||
RecentlyUsedScenePath-9:
|
||||
value: 22424703114646680e0b0227036c7b151b180b650721283704240d14f0e12d3aedff78fce9332b25
|
||||
flags: 0
|
||||
UnityRemoteCompression:
|
||||
value: 337f73
|
||||
flags: 0
|
||||
vcSharedLogLevel:
|
||||
value: 0d5e400f0650
|
||||
flags: 0
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user