Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public PlayableDirector timeline;
- private GameObject mainCam;
- public Camera cutsceneCam;
- public GameObject playerIdle;
- private GameObject text;
- private GameObject player;
- private GameObject journalUpdated;
- public bool hasFinishedTalking;
- private void Start()
- {
- text = GameObject.Find("Main Camera/ExtraUI/TalkToMarcus");
- mainCam = GameObject.Find("Main Camera");
- player = GameObject.Find("Player");
- journalUpdated = GameObject.Find("Main Camera/ExtraUI/JournalUpdated");
- text.SetActive(false);
- playerIdle.SetActive(false);
- cutsceneCam.enabled = false;
- hasFinishedTalking = false;
- }
- private void OnTriggerEnter2D(Collider2D col)
- {
- if (col.gameObject.CompareTag("Player"))
- {
- text.SetActive(true);
- }
- }
- private void OnTriggerExit2D(Collider2D col)
- {
- if (col.gameObject.CompareTag("Player"))
- {
- text.SetActive(false);
- }
- }
- private void Update()
- {
- if (text.activeInHierarchy == true && Input.GetKeyDown(KeyCode.E))
- {
- text.SetActive(false);
- timeline.Play();
- StartCoroutine(CutsceneAspects());
- }
- }
- IEnumerator CutsceneAspects()
- {
- yield return new WaitForSeconds(0.9f);
- player.GetComponent<SpriteRenderer>().enabled = false;
- mainCam.SetActive(false);
- cutsceneCam.enabled = true;
- cutsceneCam.GetComponent<AudioListener>().enabled = true;
- mainCam.GetComponent<AudioListener>().enabled = false;
- yield return new WaitForSeconds(84.4333333333333f);
- player.GetComponent<SpriteRenderer>().enabled = true;
- mainCam.SetActive(true);
- cutsceneCam.enabled = false;
- FindObjectOfType<PlayerMovement>().hasTalkedToMarcus = true;
- this.gameObject.GetComponent<BoxCollider2D>().enabled = false;
- cutsceneCam.GetComponent<AudioListener>().enabled = false;
- mainCam.GetComponent<AudioListener>().enabled = true;
- hasFinishedTalking = true;
- yield return new WaitForSeconds(1);
- journalUpdated.GetComponent<Animator>().SetBool("JournalUpdated", true);
- yield return new WaitForSeconds(7);
- journalUpdated.GetComponent<Animator>().SetBool("JournalUpdated", false);
- this.gameObject.GetComponent<BoxCollider2D>().enabled = false;
- }
Advertisement
RAW Paste Data
Copied
Advertisement