using UnityEngine;
using UnityEngine.UI;
using UnityEngine.SceneManagement;
/-----
coded by 圈毛君
2019/9/18
-----/
public class GameController : MonoBehaviour
{
// 按钮组
public Button startBtn;
public Button pauseBtn;
public Button replayBtn;
public Button escBtn;
// 布尔组
public static bool isOver = false;
private bool pauseActive = false;
// 图片组
public Image gameOver;
public Image pause;
private void Awake()
{
Time.timeScale = 0.0f; // 在点击开始按钮前都是“砸瓦鲁多”状态
}
private void Update()
{
if (isOver && gameOver.color.a < 1.0f)
{
Time.timeScale = 0.0f; // 死亡时停
//StartCoroutine(Arise()); // 利用协程显示死亡图片
Color c = gameOver.color;
c.a += 0.1f; // 死亡图片渐显
gameOver.color = c; // Color的属性不能单个修改,只能整体赋值
}
if (Input.GetK
【Unity脚本】游戏开发常用功能笔记——游戏开始,失败,暂停,重开,退出游戏
最新推荐文章于 2024-10-11 14:32:40 发布