From 4c8534b7b36e77a7c7c47a10b163695686391739 Mon Sep 17 00:00:00 2001 From: 魏曹先生 <1992414357@qq.com> Date: Sun, 1 Feb 2026 10:13:56 +0800 Subject: 整合素材 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/Scripts/GameProgressManager.cs | 42 ++++++++++++++++++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) (limited to 'Assets/Scripts/GameProgressManager.cs') diff --git a/Assets/Scripts/GameProgressManager.cs b/Assets/Scripts/GameProgressManager.cs index 463e2b3..f4d1645 100644 --- a/Assets/Scripts/GameProgressManager.cs +++ b/Assets/Scripts/GameProgressManager.cs @@ -1,12 +1,20 @@ +using System.Collections; using Tag; using UnityEngine; [RequireComponent(typeof(SceneStatus))] public class GameProgressManager : MonoBehaviour { + public int time = 60; + public MaskAnswers player1; public MaskAnswers player2; - + + public int questionMaxScore; + public int player1Score; + public int player2Score; + + public QuestionPlayer questionPlayer; public SceneStatus sceneStatus; private void Awake() @@ -31,5 +39,37 @@ public class GameProgressManager : MonoBehaviour Debug.Log("开始游戏!"); player1.bindPlayer.GetComponent().enabled = true; player2.bindPlayer.GetComponent().enabled = true; + + // 记录最大分数 + questionMaxScore = questionPlayer.currentQuestion.Need.Count; + + StartCoroutine(GameTime()); + } + + private void OnGameEnd() + { + Debug.Log("游戏结束!"); + } + + IEnumerator GameTime() + { + while (true) + { + yield return new WaitForSeconds(0.2f); + UpdateScore(); + yield return new WaitForSeconds(0.4f); + UpdateScore(); + yield return new WaitForSeconds(0.2f); + time--; + if (time <= 0) + break; + } + OnGameEnd(); + } + + private void UpdateScore() + { + player1Score = QuestionVerifier.Verify(questionPlayer.currentQuestion, player1.CollectToAnswer()); + player2Score = QuestionVerifier.Verify(questionPlayer.currentQuestion, player2.CollectToAnswer()); } } -- cgit