GameExit—PC版

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class GameExitManager : MonoBehaviour {
    public GameObject GameExit;
    public int cnt = 0;
    // Use this for initialization
    void Start()
    {
    }
    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.Escape))
        {
            cnt++;
            if (cnt > 2)
            {
                cnt = 1;
            }
            if (cnt == 1)
            {
                GameExit.SetActive(true);
            }
            else
            {
                ClickCancle();
            }
        }
    }
    public void ClickOK()
    {
        Application.Quit();
    }
    public void ClickCancle()
    {
        GameExit.SetActive(false);
        cnt = 2;
    }
}

猜你喜欢

转载自blog.csdn.net/lrh15980692010/article/details/78251716
PC:
今日推荐