fixed bumper and boulder

fixed wallrun on regular player prefab
This commit is contained in:
Melbyj1125
2022-01-28 13:11:13 -06:00
parent 4042eb1c67
commit 6bab1292f6
6 changed files with 20 additions and 10 deletions

View File

@@ -110,6 +110,7 @@ MonoBehaviour:
maxVel: 40
minVel: 20
curVel: 0
hardCapMaxVel: 0
acc: 0.01
jumpPow: 60
jumpNum: 2
@@ -197,7 +198,7 @@ MonoBehaviour:
jumpDuration: 0.02
wallBouncing: 3
cameraTransitionDuration: 1
wallGravityDownForce: 5
wallGravityDownForce: 2.8
--- !u!114 &4323471435859684389
MonoBehaviour:
m_ObjectHideFlags: 0

View File

@@ -13,14 +13,14 @@ public class Boulder : NetworkBehaviour
}
void OnTriggerEnter(Collider other) {
if (other.tag == "Player") {
if (other.transform.parent.gameObject.tag == "Player") {
GameObject player = other.gameObject;//Turns the collider into a game object
Vector3 Dir = boulder.velocity;//Finds the bolder's velocity
float Power = boulder.velocity.magnitude;// * 250;//Finds the power of the boulder by using it's velocity and a scaler
Dir = Vector3.Normalize(Dir);//Normalizes the vector to be used as a knockback direction
//Knock the player a little to the side
Dir.z += Random.Range(-0.25f, 0.25f);
player.GetComponent<dPlayerMovement>().GetHit(Dir, Power); //Ragdolls the player in the direction of the bolder depending on it's speed
player.GetComponent<PlayerMovement>().GetHit(Dir, Power); //Ragdolls the player in the direction of the bolder depending on it's speed
}
}

View File

@@ -8,7 +8,8 @@ public class Bumper : MonoBehaviour {
// Is called whenever something collides with the bumper
void OnTriggerEnter(Collider objectHit) {
if (objectHit.tag == "Player") {//Checks if the other object is the player
if (objectHit.transform.parent.gameObject.tag == "Player") {//Checks if the other object is the player
PlayerMovement playerMovement = objectHit.GetComponent<PlayerMovement>();
float DirBumpX = playerMovement.driftVel.x * -1;//Inverts the Player Velocity x

View File

@@ -503,6 +503,7 @@ public class PlayerMovement : NetworkBehaviour
//Ragdoll Functions
public void GetHit(Vector3 dir, float force){
if (!IsLocalPlayer) { return; }
if(firstHit == false){
EnableRagdoll();
dir.Normalize();

View File

@@ -5,7 +5,7 @@ using UnityEngine.Assertions;
public class PlayerStats : MonoBehaviour
{
//Maximum possible player speed
//Soft cap max speed a player can achieve they can achieve this speed by running
[SerializeField] private float maxVel = 30.0f;
public float MaxVel{
get{ return maxVel; }
@@ -26,6 +26,13 @@ public class PlayerStats : MonoBehaviour
set{ curVel = value; }
}
//The absolute max speed a player can achieve through boosts or momentum increases will disipate down to soft cap
[SerializeField] private float hardCapMaxVel;
public float HardCapMaxVel{
get{ return hardCapMaxVel; }
set{ hardCapMaxVel = value; }
}
//Player Acceleration
[SerializeField] private float acc = 0.1f;
public float Acc{

View File

@@ -9,17 +9,17 @@ EditorUserSettings:
value: 22424703114646680e0b0227036c78111b125507233d28242c20137df7ee3d2cfb
flags: 0
RecentlyUsedScenePath-1:
value: 22424703114646680e0b0227036c6f02131b172b282d347e38271427fb
flags: 0
RecentlyUsedScenePath-2:
value: 22424703114646680e0b0227036c731f1415016439262f2434
flags: 0
RecentlyUsedScenePath-3:
RecentlyUsedScenePath-2:
value: 22424703114646680e0b0227036c7b151b180b650e3a233126281f3fe7c23837e1ec25a7f234362820
flags: 0
RecentlyUsedScenePath-4:
RecentlyUsedScenePath-3:
value: 22424703114646680e0b0227036c7b151b180b6501273035202c1327d1e33136e7a923e7ee2e26
flags: 0
RecentlyUsedScenePath-4:
value: 22424703114646680e0b0227036c6f02131b172b282d347e38271427fb
flags: 0
vcSharedLogLevel:
value: 0d5e400f0650
flags: 0