Fixed Weather Wheel Bugs

- Weather now applies to respawned players
- Weather now doesn't disable movement on respawned players
- Weather Wheel can't be spammed
This commit is contained in:
2022-03-14 19:21:04 -05:00
parent 9c7f6e2f8b
commit 60e3213d41
7 changed files with 74 additions and 5 deletions

View File

@@ -2,6 +2,7 @@ using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Assertions;
using UnityEngine.SceneManagement;
public class PlayerStats : MonoBehaviour
{
@@ -172,6 +173,30 @@ public class PlayerStats : MonoBehaviour
private float tempAcc;
private float accModification;
void Start() {
// Used mainly for respawning
// Sets the weather back up if any particle systems are playing
// Make sure we are in the game scene
if (SceneManager.GetActiveScene().buildIndex == 3) {
if (GameObject.FindGameObjectWithTag("RainSystem").GetComponent<ParticleSystem>().isPlaying) {
// Rain Playing
SetWeather(Weather.Rain);
}
else if (GameObject.FindGameObjectWithTag("SnowSystem").GetComponent<ParticleSystem>().isPlaying) {
// Snow Playing
SetWeather(Weather.Snow);
}
else if (GameObject.FindGameObjectWithTag("WindSystem").GetComponent<ParticleSystem>().isPlaying) {
// Wind Playing
SetWeather(Weather.Wind, GameObject.FindGameObjectWithTag("WindSystem").GetComponent<WindDirection>().windDireciton);
}
else if (GameObject.FindGameObjectWithTag("FogSystem").GetComponent<ParticleSystem>().isPlaying) {
SetWeather(Weather.Fog);
}
}
}
//sets weather effect on player
public void SetWeather(Weather weather, Vector3 windDir = default(Vector3)){