Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEngine.SceneManagement;
- using UnityEngine.UI;
- public class GameManager : MonoBehaviour {
- public static GameManager GM;
- public GameObject player;
- public float lowerLimit = -20f;
- public GameObject HUDHistoria;
- public int coins = 0;
- public Text coinsText;
- public Text argumento;
- public GameObject HUD;
- public GameObject deadMenu;
- public Text FinalCoins;
- // Use this for initialization
- void Awake ()
- {
- if (GM == null)
- {
- GM = gameObject.GetComponent<GameManager> ();
- }
- }
- // Update is called once per frame
- void Update ()
- {
- if(player.transform.position.y <= lowerLimit)
- {
- player.GetComponent<PlayerController> ().PlayerDead ();
- }
- }
- public void PickupCoin ()
- {
- coins++;
- coinsText.text = coins.ToString ();
- if (coins == 2)
- {
- HUDHistoria.SetActive (true);
- argumento.text = "Texto de prueba";
- }
- if (coins == 8)
- {
- HUDHistoria.SetActive (true);
- argumento.text = "Texto a probar";
- }
- }
- public void EndGame ()
- {
- HUD.SetActive (false);
- FinalCoins.text = coins.ToString ();
- deadMenu.SetActive (true);
- }
- public void Retry()
- {
- SceneManager.LoadScene (SceneManager.GetActiveScene ().buildIndex);
- }
- public void MainMenu()
- {
- SceneManager.LoadScene("MainMenu");
- }
- }
Add Comment
Please, Sign In to add comment