TEST: trap and shakecam
This commit is contained in:
35
Assets/Scripts/Manager/GameManager.cs
Normal file
35
Assets/Scripts/Manager/GameManager.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
using Fusion;
|
||||
using TMPro;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class GameManager : NetworkBehaviour
|
||||
{
|
||||
public Text gameOverText; // Reference to the Game Over text UI element
|
||||
|
||||
private bool isGameOver = false; // Flag to check if the game is over
|
||||
|
||||
private void Start() {
|
||||
if (gameOverText != null) {
|
||||
// Ensure the Game Over text is hidden at the start of the game
|
||||
gameOverText.gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
|
||||
public void TriggerGameOver() {
|
||||
if (!isGameOver) {
|
||||
// Mark the game as over
|
||||
isGameOver = true;
|
||||
|
||||
if (gameOverText != null) {
|
||||
// Display the Game Over text
|
||||
gameOverText.gameObject.SetActive(true);
|
||||
}
|
||||
|
||||
// Freeze the game by setting the time scale to 0
|
||||
Time.timeScale = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user