unity期末大作业-简单桌球游戏(附下载链接)
按R重来,按esc退出游戏
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
public class GameManager : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
Restart();
ExitGame();
}
public void Restart()
{
if (Input.GetKeyDown(KeyCode.R))
{
SceneManager.LoadScene(0);
}
}
public void ExitGame()
{
if (Input.GetKeyDown(KeyCode.Escape))
{
// UnityEditor.EditorApplication.isPlaying = false;
Application.Quit();
}
}
}