private void OnGUI() { GUI.Label(new Rect(10, 5, 200, 50), "分数:", text_style); GUI.Label(new Rect(55, 5, 200, 50), action.GetScore().ToString(), score_style); GUI.Label(new Rect(Screen.width - 170, 5, 50, 50), "剩余水晶数:", text_style); GUI.Label(new Rect(Screen.width - 80, 5, 50, 50), action.GetCrystalNumber().ToString(), score_style); if (action.GetGameover() && action.GetCrystalNumber() != 0) { GUI.Label(new Rect(Screen.width / 2 - 50, Screen.width / 2 - 250, 100, 100), "游戏结束", over_style); if (GUI.Button(new Rect(Screen.width / 2 - 50, Screen.width / 2 - 150, 100, 50), "重新开始")) { action.Restart(); return; } } else if (action.GetCrystalNumber() == 0) { GUI.Label(new Rect(Screen.width / 2 - 50, Screen.width / 2 - 250, 100, 100), "恭喜胜利!", over_style); if (GUI.Button(new Rect(Screen.width / 2 - 50, Screen.width / 2 - 150, 100, 50), "重新开始")) { action.Restart(); return; } } if (show_time > 0) { GUI.Label(new Rect(Screen.width / 2 - 120, 10, 100, 100), "按WSAD或方向键移动,点击鼠标射击", text_style); GUI.Label(new Rect(Screen.width / 2 - 87, 30, 100, 100), "成功躲避巡逻兵追捕加1分", text_style); GUI.Label(new Rect(Screen.width / 2 - 90, 50, 100, 100), "采集完所有的水晶即可获胜", text_style); } }