diff options
Diffstat (limited to 'Assets/Scripts/GameProgressManager.cs')
| -rw-r--r-- | Assets/Scripts/GameProgressManager.cs | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/Assets/Scripts/GameProgressManager.cs b/Assets/Scripts/GameProgressManager.cs new file mode 100644 index 0000000..463e2b3 --- /dev/null +++ b/Assets/Scripts/GameProgressManager.cs @@ -0,0 +1,35 @@ +using Tag; +using UnityEngine; + +[RequireComponent(typeof(SceneStatus))] +public class GameProgressManager : MonoBehaviour +{ + public MaskAnswers player1; + public MaskAnswers player2; + + public SceneStatus sceneStatus; + + private void Awake() + { + sceneStatus = GetComponent<SceneStatus>(); + } + + public void Refresh() + { + if (player1.bindPlayer != null && + player2.bindPlayer != null && + SceneStatus.Instance.current == Status.Waiting) + { + // 开始游戏 + sceneStatus.current = Status.Playing; + OnGameStart(); + } + } + + private void OnGameStart() + { + Debug.Log("开始游戏!"); + player1.bindPlayer.GetComponent<PlayerMovement>().enabled = true; + player2.bindPlayer.GetComponent<PlayerMovement>().enabled = true; + } +} |
