campfire/Assets/Scripts/GameOverVR.cs

16 lines
509 B
C#
Raw Permalink Normal View History

using UnityEngine;
using UnityEngine.Rendering.PostProcessing;
using UnityEngine.SceneManagement;
public class GameOverVR : MonoBehaviour {
public PostProcessVolume DarknessVolume;
public GameState GameState;
private void Update() {
2020-06-13 01:12:10 +02:00
DarknessVolume.weight = Mathf.Lerp(DarknessVolume.weight, GameState.Current == State.GameOver ? 1 : 0, 0.5f * Time.deltaTime);
if (DarknessVolume.weight >= 0.9) {
SceneManager.LoadScene("Scenes/VRGameOverScene");
}
}
}