Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class Drive : MonoBehaviour
- {
- public GameObject ControllerButton;
- public GameObject OpenTheDoorAndTurnLight;
- public GameObject DriveButton;
- // Start is called before the first frame update
- void Start()
- {
- DriveButton.SetActive(false);
- ControllerButton.SetActive(false);
- }
- // Update is called once per frame
- void Update()
- {
- }
- public void StartDrive()
- {
- ControllerButton.SetActive(true);
- OpenTheDoorAndTurnLight.SetActive(false);
- DriveButton.SetActive(false);
- }
- }
- ////
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEngine.UI;
- using UnityEngine.SceneManagement;
- public class AssyncLoad : MonoBehaviour
- {
- public int scene;
- public GameObject button;
- public GameObject sliderObj;
- public Slider slider;
- //start Coroutine
- public void load()
- {
- StartCoroutine(loadscene());
- }
- //signature to event
- public void Start()
- {
- iventsistem.instance.time += load;
- }
- //routin
- IEnumerator loadscene()
- {
- button.SetActive(false);
- sliderObj.SetActive(true);
- AsyncOperation operation = SceneManager.LoadSceneAsync(scene);
- //while done
- while (!operation.isDone)
- {
- float progress = Mathf.Clamp01(operation.progress / .9f);
- slider.value = progress;
- yield return null;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment