campfire/Assets/Scripts/GameOverVR.cs

16 lines
508 B
C#

using UnityEngine;
using UnityEngine.Rendering.PostProcessing;
using UnityEngine.SceneManagement;
public class GameOverVR : MonoBehaviour {
public PostProcessVolume DarknessVolume;
public GameState GameState;
private void Update() {
DarknessVolume.weight = Mathf.Lerp(DarknessVolume.weight, GameState.Current == State.GameOver ? 1 : 0, 3f * Time.deltaTime);
if (DarknessVolume.weight >= 0.99) {
SceneManager.LoadScene("Scenes/VRGameOverScene");
}
}
}