using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.SceneManagement; public class OP : MonoBehaviour { //控制开始页面的脚本 // Start is called before the first frame update public SpriteRenderer start; public SpriteRenderer quit; public Sprite startC; public Sprite startN; public Sprite quitC; public Sprite quitN; private bool nowChoose = true;//true代表选开始,false代表选退出 public GameObject blackUI; public AudioClip clip; void Start() { } // Update is called once per frame void Update() { } public void OnChooseUpOne() { start.sprite = startC; quit.sprite = quitN; nowChoose = true; } public void OnChooseDownOne() { start.sprite = startN; quit.sprite = quitC; nowChoose = false; } public void OnComfirm() { if (nowChoose)//如果按了开始游戏 { blackUI.SetActive(true); Invoke("InToTheGame",2f); FindObjectOfType().ChangedTheBGM(clip); } else//如果按了退出游戏 { Application.Quit(); } } public void InToTheGame() { SceneManager.LoadScene("序章-家中"); } }