mirror of
https://github.com/Leahnaya/TheKingsRace.git
synced 2026-08-21 18:04:27 -05:00
Merge branch 'Sprint5Melby'
This commit is contained in:
@@ -28,8 +28,6 @@ public class dKickController : NetworkBehaviour
|
||||
}
|
||||
|
||||
void Kick(){
|
||||
//Note: when we merge this into PlayerMovement, we may want to change isgrounded to our
|
||||
//custom is grounded
|
||||
if (Input.GetKeyDown(KeyCode.F) && isKicking == false && characterController.isGrounded == false)
|
||||
{
|
||||
Debug.Log("dive");
|
||||
@@ -67,6 +65,9 @@ public class dKickController : NetworkBehaviour
|
||||
//if (!IsLocalPlayer) { return; }
|
||||
Collider myCollider = collision.contacts[0].thisCollider;
|
||||
if (collision.transform.CompareTag("kickable") && myCollider == leg.GetComponent<Collider>()){
|
||||
if(collision.gameObject.GetComponent<Rigidbody>().isKinematic == true){
|
||||
collision.gameObject.GetComponent<Rigidbody>().isKinematic = false;
|
||||
}
|
||||
Vector3 direction = this.transform.forward;
|
||||
Debug.Log(direction);
|
||||
collision.rigidbody.AddForce(direction * pStats.KickPow, ForceMode.Impulse);
|
||||
|
||||
@@ -7,7 +7,7 @@ using UnityEngine.Rendering;
|
||||
public class dWallRun : NetworkBehaviour
|
||||
{
|
||||
|
||||
public float wallMaxDistance = 5;
|
||||
public float wallMaxDistance = .8f;
|
||||
public float wallSpeedMultiplier = 1.2f;
|
||||
public float minimumHeight = .1f;
|
||||
public float maxAngleRoll = 20;
|
||||
@@ -151,13 +151,35 @@ public class dWallRun : NetworkBehaviour
|
||||
Vector3 moveToSet = alongWall * vertical * playerMovementController.PlayerSpeed() * Time.deltaTime;// * wallSpeedMultiplier;
|
||||
Vector3 velNorm = playerMovementController.vel;
|
||||
velNorm.Normalize();
|
||||
|
||||
moveToSet = new Vector3(moveToSet.x * -velNorm.x, moveToSet.y, moveToSet.z * -velNorm.z);
|
||||
|
||||
Vector3 moveToSetNorm = moveToSet;
|
||||
moveToSetNorm.Normalize();
|
||||
|
||||
if((moveToSetNorm.x < 0 && velNorm.x > 0)){
|
||||
moveToSet.x = (moveToSet.x * -velNorm.x);
|
||||
}
|
||||
else if((moveToSetNorm.x > 0 && velNorm.x < 0) ){
|
||||
moveToSet.x = (-moveToSet.x * -velNorm.x);
|
||||
}
|
||||
|
||||
if((moveToSetNorm.z < 0 && velNorm.z > 0)){
|
||||
moveToSet.z = (moveToSet.z * -velNorm.z);
|
||||
}
|
||||
else if((moveToSetNorm.z > 0 && velNorm.z < 0)){
|
||||
moveToSet.z = (-moveToSet.z * -velNorm.z);
|
||||
}
|
||||
|
||||
moveToSet.y = 0;
|
||||
|
||||
|
||||
playerMovementController.SetPlayerVelocity(moveToSet);
|
||||
Debug.Log(moveToSet);
|
||||
isWallRunning = true;
|
||||
if(playerMovementController.curJumpNum != 0){
|
||||
playerMovementController.curJumpNum = 0 ;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -175,10 +197,6 @@ public class dWallRun : NetworkBehaviour
|
||||
|
||||
public Vector3 GetWallJumpDirection() //Add call in jump where if we are wallrunning and jump, the jump vector is multiplied by this
|
||||
{
|
||||
if(isWallRunning)
|
||||
{
|
||||
return lastWallNormal * wallBouncing + Vector3.up;
|
||||
}
|
||||
return Vector3.zero;
|
||||
}
|
||||
return lastWallNormal * wallBouncing + (transform.up);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
@@ -65,7 +65,7 @@ public class dPlayerMovement : NetworkBehaviour
|
||||
private Rigidbody rB;
|
||||
private CapsuleCollider capCol;
|
||||
private bool firstHit = false;
|
||||
private bool heldDown = false;
|
||||
//private bool heldDown = false; //Variable for testing Ragdoll reenable if needed
|
||||
private bool beginRagTimer = false;
|
||||
private float ragTime;
|
||||
private Vector3 prevRot;
|
||||
@@ -261,7 +261,14 @@ 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 * 1.3f);
|
||||
AddImpact(transform.up, pStats.JumpPow);
|
||||
}
|
||||
else{
|
||||
AddImpact(transform.up, pStats.JumpPow);
|
||||
}
|
||||
|
||||
curJumpNum++;
|
||||
jumpPressed = true;
|
||||
}
|
||||
@@ -357,8 +364,10 @@ public class dPlayerMovement : NetworkBehaviour
|
||||
|
||||
//Wallrunning
|
||||
else if (pStats.HasWallrun) { wallRun.WallRunRoutine(); } //adjusted later if we are wallrunning
|
||||
//If gliding
|
||||
//Go down slowly
|
||||
|
||||
else{
|
||||
vel.y -= pStats.PlayerGrav * Time.deltaTime;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user