using System.Collections; using System.Collections.Generic; using System; using UnityEngine; using UnityEngine.Events; using UnityEngine.SceneManagement; public class GameManager : MonoBehaviour { public static GameManager Instance { get; private set; } public Action OnPlayerDied; private string penisSuriveTime = ""; public int Revives { get; private set; } void Awake() { if (Instance == null) { Instance = this; DontDestroyOnLoad(gameObject); Revives = 0; } else { Destroy(gameObject); } } void Start() { } public void playerDied(GameObject who) { if (Revives == 0) SceneManager.LoadScene(3); else { Revives--; Collider2D[] d = Physics2D.OverlapCircleAll(who.transform.position, 5f); foreach (Collider2D c in d) { if (c.gameObject.CompareTag("Enemy")) { c.gameObject.GetComponent().TakeDamage(9999999999); } } var g = who.GetComponent(); // heal g.setMaxHealth(g.getMaxHealth(), true); // REVIVE SOUND HERE } } public void setTime(string t) { penisSuriveTime = t; } // Update is called once per frame void Update() { } }