This commit is contained in:
Katherine
2021-12-13 12:30:28 -06:00
345 changed files with 38952 additions and 43309 deletions

View File

@@ -0,0 +1,51 @@
using MLAPI;
using MLAPI.Messaging;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Boulder : NetworkBehaviour
{
private Rigidbody boulder;
void Start() {
boulder = GetComponent<Rigidbody>();//Gets the rigidbody attached to the bolder
}
void OnTriggerEnter(Collider other) {
if (other.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
}
}
public void StartCountdown(int time, Vector3 spawnForce)
{
StartCoroutine(DespawnCounter(time));
AddForceServerRPC(spawnForce);
}
[ServerRpc]
private void AddForceServerRPC(Vector3 force) {
this.gameObject.GetComponent<Rigidbody>().AddForce(force);
}
IEnumerator DespawnCounter(int time) {
for (int i = time; i > 0; i--) {
yield return new WaitForSecondsRealtime(1f);
}
// Time's up - Despawn us
DespawnBoulderServerRPC();
}
[ServerRpc(RequireOwnership = false)]
private void DespawnBoulderServerRPC() {
this.gameObject.GetComponent<NetworkObject>().Despawn(true);
}
}

View File

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

View File

@@ -0,0 +1,25 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Bumper : MonoBehaviour {
public float bumpPower = 30;
// Is called whenever something collides with the bumper
void OnTriggerEnter(Collider objectHit) {
if (objectHit.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
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

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

View File

@@ -0,0 +1,26 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Goo : MonoBehaviour
{
int Lifetime = 0;
void FixedUpdate() {
Lifetime++;
if(Lifetime == 550) {
Destruction();
}
}
//Makes the player sliperly whenever they step on the goo
void OnTriggerEnter(Collider other) {
Debug.Log("Slippy!");
GameObject player = other.gameObject;//Turns the collider into a game object
player.GetComponent<PlayerStats>().Traction = 1.5f;//Make it slippy
}
void Destruction() {
Destroy(gameObject);
}
}

View File

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

View File

@@ -0,0 +1,52 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Hail : MonoBehaviour
{
private Rigidbody hail;
public GameObject shadow;
private float ShadStSz = 0;
private float m;
private GameObject ShadTemp = null;
void Start() {
hail = GetComponent<Rigidbody>();//Gets the rigidbody attached to the bolder
ShadTemp = Instantiate(shadow);//Creates the shadow
ShadTemp.transform.position = new Vector3(hail.transform.position.x, 0, hail.transform.position.z);//Sets it properly directly under the hail
ShadTemp.transform.localScale = new Vector3(ShadStSz, 0, ShadStSz);//Scales it to the proper start size
m = (hail.transform.localScale.x - ShadStSz) / 30;//Find the proper rate of growth
}
void FixedUpdate() {
float y = m * (hail.transform.position.y-30) + ShadStSz;//Find the proper current size
ShadTemp.transform.localScale = new Vector3(y, 0, y);//Scales the shadow to that size
Destruction();//Sees if it needs to destroy both
}
void OnTriggerEnter(Collider other) {
if (other.tag == "Player") {
GameObject player = other.gameObject;//Turns the collider into a game object
float Power = hail.velocity.magnitude * 10;//Finds the power of the hail by using it's velocity and a scaler
//Find the dirrection of launch by finding the direction between the two points of the player and the Hail
float px = player.transform.position.x;
float pz = player.transform.position.z;
float hx = hail.transform.position.x;
float hz = hail.transform.position.z;
//Direction pointing away from the center of the Hail
Vector3 Dir = new Vector3(px - hx, 0, pz - hz);
player.GetComponent<dPlayerMovement>().GetHit(Dir, Power); //Ragdolls the player in the direction of the bolder depending on it's speed
}
}
//Destroys the Hail and its shadow
void Destruction() {
if(hail.transform.position.y <= 0) {
Destroy(ShadTemp);
Destroy(gameObject);
}
}
}

View File

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

View File

@@ -0,0 +1,43 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class HailArea : MonoBehaviour
{
// Update is called once per frame
public float Xmax = 15f;
public float Xmin = -15f;
public float Zmax = -85f;
public float Zmin = -115f;
public GameObject Hail;
int timer = 0;
// FixedUpdate is called once per .02 seconds (or 50 times a second)
void FixedUpdate()
{
if (timer == 50) {
timer = 0;
//Random diameter 4->8
float diameter = Random.Range(4, 8);
float radius = diameter / 2.0f;
//Random pos X Xmax-radius -> Xmin+radius
//Random pos Z Zmax-radius -> Zmin+radius
Vector3 position = new Vector3(Random.Range(Xmin + radius, Xmax - radius), 30, Random.Range(Zmin + radius, Zmax - radius));
SpawnHail(diameter, position);
}
timer++;
}
// Spawns a singular Hail piece
void SpawnHail(float size, Vector3 pos)
{
//Spawn HailBall and its shadow
GameObject HailTemp = null;
HailTemp = Instantiate(Hail);
HailTemp.transform.position = pos;
HailTemp.transform.localScale = new Vector3(size, size, size);
}
}

View File

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

View File

@@ -0,0 +1,49 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Slime : MonoBehaviour
{
float MoveDir;
int GooTimer = 0;
Vector3 offset = new Vector3(0.0f, 0.4f, 0.0f);
public GameObject Goo;
public GameObject Folder;
public int StartPos = -29;
public int EndPos = -57;
// Start is called before the first frame update
void Start()
{
MoveDir = Time.deltaTime;
}
// FixedUpdate is called once per .02 seconds (or 50 times a second)
void FixedUpdate()
{
//create goo underneath them slime
if (GooTimer == 6) {
GameObject GooTrail = null;
GooTrail = Instantiate(Goo, transform.position - offset, transform.rotation);
GooTrail.transform.parent = Folder.transform;
GooTimer = 0;
}
//attempt to move forward (Raycast for objects, how to make sure it didn't fall off a cliff?)
if (transform.position.z >= StartPos || transform.position.z <= EndPos) {//Rough way of keeping turning it around when it reaches an end
MoveDir = -MoveDir;
}
//if can't Turn around 180 degrees
//otherwise actually move forward
transform.Translate(0, 0, MoveDir);
GooTimer++;
}
void OnTriggerStay(Collider other) {
//slow down player
GameObject player = other.gameObject;//Turns the collider into a game object
//Get the Player's speed
float CurVel = player.GetComponent<PlayerStats>().CurVel;
player.GetComponent<PlayerStats>().CurVel = CurVel - (CurVel/10);
//Cut it in half?
}
}

View File

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

View File

@@ -0,0 +1,19 @@
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<dPlayerMovement>().AddImpact(DirWind, 1);
}
}

View File

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