void Start() { instance = this; player = GameObject.FindObjectOfType <Player>(); Load_UI_Values(); }
//Se llama cuando se destruye un objeto void OnDestroy() { if (!UICountdown.IsGameFinished) { UICountdown.TimerBonus = 3 * CoinValue * CoinValue; } Coin.CoinsCount -= CoinValue; UI_Coins.UpdateCoins(); if (Coin.CoinsCount <= 0 && !UICountdown.IsGameFinished) { Debug.Log("He recogido todas las monedas. Game Over"); UICountdown.IsGameFinished = true; int SceneId = SceneManager.GetActiveScene().buildIndex; SceneManager.LoadScene(SceneId, LoadSceneMode.Single); } }