campfire/Assets/Scripts/PauseMenu.cs

23 lines
530 B
C#
Raw Normal View History

2020-04-18 18:26:35 +02:00
using UnityEngine;
[RequireComponent(typeof(CanvasGroup))]
public class PauseMenu : MonoBehaviour {
2020-04-19 01:12:29 +02:00
public GameState GameState;
2020-04-18 18:26:35 +02:00
private CanvasGroup Canvas;
2020-04-19 01:12:29 +02:00
private bool Paused {
get {
return GameState.Current == State.Paused;
}
}
2020-04-18 18:26:35 +02:00
private void Awake() {
Canvas = GetComponent<CanvasGroup>();
2020-04-18 22:52:37 +02:00
Canvas.alpha = Paused ? 1 : 0;
2020-04-18 18:26:35 +02:00
}
private void Update() {
Canvas.alpha = Mathf.Lerp(Canvas.alpha, Paused ? 1 : 0, 10f * Time.unscaledDeltaTime);
}
}