using UnityEngine; using UnityEngine.UI; public class ArchiveScript : MonoBehaviour { private static ArchiveScript intance; public Image bar; public CanvasGroup escapeCG; public CanvasGroup wholeCG; private bool hide; private float escapeCounter; private void Start() { if (intance == null) { intance = this; Object.DontDestroyOnLoad(base.gameObject); } else { Object.Destroy(intance.gameObject); } } private void Update() { if (Input.GetKeyDown(KeyCode.H)) { hide = !hide; if (hide) { wholeCG.alpha = 0f; } else { wholeCG.alpha = 1f; } } if (Input.GetKey(KeyCode.Escape)) { escapeCounter += Time.deltaTime; if (escapeCounter > 1f) { Application.Quit(); } } else { escapeCounter -= Time.deltaTime; } escapeCounter = Mathf.Clamp(escapeCounter, 0f, 2f); escapeCG.alpha = escapeCounter * 2f; bar.fillAmount = escapeCounter; } }