23 lines
530 B
C#
23 lines
530 B
C#
using UnityEngine;
|
|
|
|
[RequireComponent(typeof(CanvasGroup))]
|
|
public class PauseMenu : MonoBehaviour {
|
|
public GameState GameState;
|
|
|
|
private CanvasGroup Canvas;
|
|
private bool Paused {
|
|
get {
|
|
return GameState.Current == State.Paused;
|
|
}
|
|
}
|
|
|
|
private void Awake() {
|
|
Canvas = GetComponent<CanvasGroup>();
|
|
Canvas.alpha = Paused ? 1 : 0;
|
|
}
|
|
|
|
private void Update() {
|
|
Canvas.alpha = Mathf.Lerp(Canvas.alpha, Paused ? 1 : 0, 10f * Time.unscaledDeltaTime);
|
|
}
|
|
}
|