Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public PlayableDirector finalTest;
- private GameObject text;
- private GameObject mainCam;
- private GameObject player;
- public PlayableDirector timeline;
- public Camera cutsceneCam;
- public GameObject playerIdle;
- public GameObject barTrigger;
- public GameObject crimeSceenTrigger;
- public GameObject alleyTrigger;
- public GameObject zoneBlockers;
- public GameObject policeman;
- public bool canInteract;
- private GameObject JournalUnlockedText;
- private GameObject skillpointGainedText;
- private void Start()
- {
- text = GameObject.Find("Main Camera/ExtraUI/TalkToFederna");
- mainCam = GameObject.Find("Main Camera");
- player = GameObject.Find("Player");
- text.SetActive(false);
- cutsceneCam.enabled = false;
- playerIdle.SetActive(false);
- canInteract = true;
- barTrigger.SetActive(false);
- crimeSceenTrigger.SetActive(false);
- alleyTrigger.SetActive(false);
- zoneBlockers.SetActive(true);
- policeman.GetComponent<BoxCollider2D>().enabled = false;
- JournalUnlockedText = GameObject.Find("Main Camera/ExtraUI/UnlockedJournal");
- skillpointGainedText = GameObject.Find("Main Camera/ExtraUI/SkillPointGained");
- }
- private void OnTriggerEnter2D(Collider2D col)
- {
- if (col.gameObject.CompareTag("Player") && canInteract == true)
- {
- text.SetActive(true);
- }
- }
- private void OnTriggerExit2D(Collider2D col)
- {
- if (col.gameObject.CompareTag("Player") && canInteract == true)
- {
- text.SetActive(false);
- }
- }
- private void Update()
- {
- if (text.activeInHierarchy == true && Input.GetKeyDown(KeyCode.E) && FindObjectOfType<AllSuspectsInterviewed>().talkedToEveryone == false)
- {
- timeline.Play();
- cutsceneCam.enabled = true;
- StartCoroutine(CutsceneAspects());
- canInteract = false;
- Points.pointsValue += 1;
- cutsceneCam.GetComponent<AudioListener>().enabled = true;
- }
- if (text.activeInHierarchy == true && Input.GetKeyDown(KeyCode.E) && FindObjectOfType<AllSuspectsInterviewed>().talkedToEveryone == true)
- {
- finalTest.Play();
- text.SetActive(false);
- StartCoroutine(ChoosingSuspect());
- cutsceneCam.GetComponent<AudioListener>().enabled = true;
- }
- if (FindObjectOfType<PlayerMovement>().hasTalkedToFederna == true)
- {
- this.gameObject.GetComponent<BoxCollider2D>().enabled = false;
- barTrigger.SetActive(true);
- crimeSceenTrigger.SetActive(true);
- alleyTrigger.SetActive(true);
- zoneBlockers.SetActive(false);
- policeman.GetComponent<BoxCollider2D>().enabled = true;
- }
- }
- IEnumerator CutsceneAspects()
- {
- yield return new WaitForSeconds(0.9f);
- mainCam.SetActive(false);
- player.GetComponent<SpriteRenderer>().enabled = false;
- yield return new WaitForSeconds(40.4333333333333f);
- mainCam.SetActive(true);
- player.GetComponent<SpriteRenderer>().enabled = true;
- FindObjectOfType<PauseMenu>().journalLocked = false;
- FindObjectOfType<PauseMenu>().isPadlockActive = false;
- cutsceneCam.GetComponent<AudioListener>().enabled = false;
- yield return new WaitForSeconds(2);
- JournalUnlockedText.GetComponent<Animator>().SetBool("UnlockedJournal", true);
- yield return new WaitForSeconds(6.5f);
- skillpointGainedText.GetComponent<Animator>().SetBool("GainedPoint", true);
- FindObjectOfType<PlayerMovement>().hasTalkedToFederna = true;
- policeman.GetComponent<BoxCollider2D>().enabled = true;
- yield return new WaitForSeconds(6);
- skillpointGainedText.GetComponent<Animator>().SetBool("GainedPoint", false);
- }
- private void FixedUpdate()
- {
- if (canInteract == false)
- {
- text.SetActive(false);
- }
- }
- IEnumerator ChoosingSuspect()
- {
- yield return new WaitForSeconds(0.9f);
- mainCam.SetActive(false);
- cutsceneCam.enabled = true;
- playerIdle.SetActive(true);
- player.GetComponent<SpriteRenderer>().enabled = false;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement