Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEngine.UI;
- public class timer : MonoBehaviour
- {
- public int time = 30;
- public Text takeONme;
- // Start is called before the first frame update
- void Start()
- {
- StartCoroutine(timeon());
- }
- // Update is called once per frame
- void Update()
- {
- takeONme.text = time.ToString();
- //if time go over
- if (time == 0)
- {
- iventsistem.instance.Ontime();
- }
- }
- //routin
- public IEnumerator timeon()
- {
- //while time is longer zero
- while(time > 0)
- {
- yield return new WaitForSeconds(1);
- time -= 1;
- }
- }
- }
- //
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class audio : MonoBehaviour
- {
- public GameObject proop;
- public GameObject ulose;
- //signature to event
- void Start()
- {
- proop.SetActive(false);
- ulose.SetActive(false);
- iventsistem.instance.time += uloose;
- iventsistem.instance.Win += uloose;
- iventsistem.instance.Lose += uloose;
- iventsistem.instance.Sound += prooop;
- }
- //sound ON
- public void prooop()
- {
- proop.SetActive(true);
- StartCoroutine(sound());
- }
- //sound ON
- public void uloose()
- {
- ulose.SetActive(true);
- }
- //routin
- IEnumerator sound()
- {
- yield return new WaitForSeconds(0.2f);
- proop.SetActive(false);
- }
- }
- ///
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEngine.UI;
- public class GameOver : MonoBehaviour
- {
- public Text losee;
- //signature to event
- void Start()
- {
- iventsistem.instance.Win += win;
- iventsistem.instance.Lose += lose;
- }
- //text output
- public void lose()
- {
- losee.text = "you lose";
- }
- //text output
- public void win()
- {
- losee.text = "you win";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement