Fixed a lot of the issues we addressed on Monday

This commit is contained in:
Melbyj1125
2022-03-09 02:16:56 -06:00
parent 03a96b8c67
commit 7ae4b643a1
31 changed files with 161 additions and 222 deletions

View File

@@ -7,20 +7,26 @@ using UnityEngine;
public class Boulder : NetworkBehaviour
{
private Rigidbody boulder;
public float bumpPower = 70;
void Start() {
boulder = GetComponent<Rigidbody>();//Gets the rigidbody attached to the bolder
}
void OnTriggerEnter(Collider other) {
if (other.gameObject.tag == "ArcherTarget") {
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<MoveStateManager>().GetHit(Dir, Power); //Ragdolls the player in the direction of the bolder depending on it's speed
void OnTriggerEnter(Collider objectHit) {
if (objectHit.gameObject.tag == "ArcherTarget") {
Debug.Log("Bump");
MoveStateManager playerMovement = objectHit.GetComponent<MoveStateManager>();
float DirBumpX = playerMovement.driftVel.x * -1;//Inverts the Player Velocity x
float DirBumpY = .1f;
float DirBumpZ = playerMovement.driftVel.z * -1;//Inverts the Player Velocity z
Vector3 DirBump = new Vector3(DirBumpX, DirBumpY, DirBumpZ);//Creates a direction to launch the player
DirBump = Vector3.Normalize(DirBump);//Normalizes the vector to be used as a bump direction
playerMovement.GetHit(DirBump, bumpPower);
}
}

View File

@@ -1,57 +0,0 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Rain : MonoBehaviour
{
private float tractionDefault;
private float accelerationDefault;
//Options for reduction
// % based aka you have 75% traction while in rain <- with this option we wouldn't need to care about individual players starting points
// Flat reduction penalty of number i.e. 3?
//Make rain increase acceleration
private void OnTriggerEnter(Collider other)
{
if (other.tag == "Player") //In multiplayer we may need a player 1 - X tag for keeping track of individual stats
{
PlayerStats pStats = other.gameObject.GetComponent<PlayerStats>();
tractionDefault = pStats.Traction;
if (tractionDefault > 3)
{
pStats.Traction -= 3;
}
else
{
pStats.Traction = 1;
}
accelerationDefault = pStats.Acc;
if (accelerationDefault < 8)
{
pStats.Acc += 3;
}
else
{
pStats.Acc = 10;
}
//pStats.Acc *= 1.25f;
//pStats.Traction *= 0.75f;
}
}
private void OnTriggerExit(Collider other)
{
if (other.tag == "Player")
{
PlayerStats pStats = other.gameObject.GetComponent<PlayerStats>();
pStats.Traction = tractionDefault;
pStats.Acc = accelerationDefault;
//pStats.Acc /= 1.25f;
//pStats.Traction /= 0.75f;
}
}
}

View File

@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: c28022a6946b2ed44b657d7aecae5c1c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,56 +0,0 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Snow : MonoBehaviour
{
private float tractionDefault;
private float accelerationDefault;
//Options for increase
// % based aka you have 75% traction while in rain <- with this option we wouldn't need to care about individual players starting points
// Flat reduction penalty of number i.e. 3?
//snow reduces acceleration <- playtest to consider adjusting max speed as well
private void OnTriggerEnter(Collider other)
{
if (other.tag == "Player") //In multiplayer we may need a player 1 - X tag for keeping track of individual stats
{
PlayerStats pStats = other.gameObject.GetComponent<PlayerStats>();
tractionDefault = pStats.Traction;
if (tractionDefault < 8)
{
pStats.Traction += 3;
}
else
{
pStats.Traction = 10;
}
accelerationDefault = pStats.Acc;
if (accelerationDefault > 3)
{
pStats.Acc -= 3;
}
else
{
pStats.Acc = 1;
}
//pStats.Traction *= 1.25f;
//pStats.Acc *= 0.75f;
}
}
private void OnTriggerExit(Collider other)
{
if (other.tag == "Player")
{
PlayerStats pStats = other.gameObject.GetComponent<PlayerStats>();
pStats.Traction = tractionDefault;
pStats.Acc = accelerationDefault;
//pStats.Traction /= 1.25f;
//pStats.Acc /= 0.75f;
}
}
}

View File

@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: c3ae4500a963332498d7e31700c2a9ae
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,19 +0,0 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Wind : MonoBehaviour
{
public Vector3 DirWind;
// Start is called before the first frame update
void Start()
{
DirWind = Vector3.forward;
}
// Update is called once per frame
void OnTriggerStay(Collider other)
{
other.GetComponent<AerialStateManager>().AddImpact(DirWind, 1);
}
}

View File

@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 3cbfce7770492384d8edacf924191f0a
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: