Advertisement
jretchy

Untitled

May 17th, 2022
789
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 4.38 KB | None | 0 0
  1.  
  2.  
  3.     public PlayableDirector finalTest;
  4.  
  5.     private GameObject text;
  6.     private GameObject mainCam;
  7.     private GameObject player;
  8.     public PlayableDirector timeline;
  9.     public Camera cutsceneCam;
  10.     public GameObject playerIdle;
  11.  
  12.     public GameObject barTrigger;
  13.     public GameObject crimeSceenTrigger;
  14.     public GameObject alleyTrigger;
  15.     public GameObject zoneBlockers;
  16.     public GameObject policeman;
  17.  
  18.     public bool canInteract;
  19.  
  20.     private GameObject JournalUnlockedText;
  21.     private GameObject skillpointGainedText;
  22.  
  23.     private void Start()
  24.     {
  25.         text = GameObject.Find("Main Camera/ExtraUI/TalkToFederna");
  26.         mainCam = GameObject.Find("Main Camera");
  27.         player = GameObject.Find("Player");
  28.         text.SetActive(false);
  29.         cutsceneCam.enabled = false;
  30.         playerIdle.SetActive(false);
  31.  
  32.         canInteract = true;
  33.  
  34.         barTrigger.SetActive(false);
  35.         crimeSceenTrigger.SetActive(false);
  36.         alleyTrigger.SetActive(false);
  37.         zoneBlockers.SetActive(true);
  38.  
  39.         policeman.GetComponent<BoxCollider2D>().enabled = false;
  40.  
  41.         JournalUnlockedText = GameObject.Find("Main Camera/ExtraUI/UnlockedJournal");
  42.         skillpointGainedText = GameObject.Find("Main Camera/ExtraUI/SkillPointGained");
  43.     }
  44.  
  45.     private void OnTriggerEnter2D(Collider2D col)
  46.     {
  47.         if (col.gameObject.CompareTag("Player") && canInteract == true)
  48.         {
  49.             text.SetActive(true);
  50.         }
  51.     }
  52.  
  53.  
  54.     private void OnTriggerExit2D(Collider2D col)
  55.     {
  56.         if (col.gameObject.CompareTag("Player") && canInteract == true)
  57.         {
  58.             text.SetActive(false);
  59.         }
  60.     }
  61.  
  62.     private void Update()
  63.     {
  64.         if (text.activeInHierarchy == true && Input.GetKeyDown(KeyCode.E) && FindObjectOfType<AllSuspectsInterviewed>().talkedToEveryone == false)
  65.         {
  66.             timeline.Play();
  67.             cutsceneCam.enabled = true;
  68.             StartCoroutine(CutsceneAspects());
  69.             canInteract = false;
  70.             Points.pointsValue += 1;
  71.             cutsceneCam.GetComponent<AudioListener>().enabled = true;
  72.         }
  73.  
  74.         if (text.activeInHierarchy == true && Input.GetKeyDown(KeyCode.E) && FindObjectOfType<AllSuspectsInterviewed>().talkedToEveryone == true)
  75.         {
  76.             finalTest.Play();
  77.             text.SetActive(false);
  78.             StartCoroutine(ChoosingSuspect());
  79.             cutsceneCam.GetComponent<AudioListener>().enabled = true;
  80.         }
  81.  
  82.         if (FindObjectOfType<PlayerMovement>().hasTalkedToFederna == true)
  83.         {
  84.             this.gameObject.GetComponent<BoxCollider2D>().enabled = false;
  85.  
  86.  
  87.             barTrigger.SetActive(true);
  88.             crimeSceenTrigger.SetActive(true);
  89.             alleyTrigger.SetActive(true);
  90.             zoneBlockers.SetActive(false);
  91.             policeman.GetComponent<BoxCollider2D>().enabled = true;
  92.         }
  93.     }
  94.  
  95.     IEnumerator CutsceneAspects()
  96.     {
  97.         yield return new WaitForSeconds(0.9f);
  98.         mainCam.SetActive(false);
  99.         player.GetComponent<SpriteRenderer>().enabled = false;
  100.  
  101.         yield return new WaitForSeconds(40.4333333333333f);
  102.         mainCam.SetActive(true);
  103.         player.GetComponent<SpriteRenderer>().enabled = true;
  104.  
  105.         FindObjectOfType<PauseMenu>().journalLocked = false;
  106.         FindObjectOfType<PauseMenu>().isPadlockActive = false;
  107.  
  108.         cutsceneCam.GetComponent<AudioListener>().enabled = false;
  109.  
  110.         yield return new WaitForSeconds(2);
  111.         JournalUnlockedText.GetComponent<Animator>().SetBool("UnlockedJournal", true);
  112.  
  113.         yield return new WaitForSeconds(6.5f);
  114.         skillpointGainedText.GetComponent<Animator>().SetBool("GainedPoint", true);
  115.  
  116.         FindObjectOfType<PlayerMovement>().hasTalkedToFederna = true;
  117.  
  118.  
  119.         policeman.GetComponent<BoxCollider2D>().enabled = true;
  120.  
  121.         yield return new WaitForSeconds(6);
  122.         skillpointGainedText.GetComponent<Animator>().SetBool("GainedPoint", false);
  123.     }
  124.  
  125.     private void FixedUpdate()
  126.     {
  127.         if (canInteract == false)
  128.         {
  129.             text.SetActive(false);
  130.         }
  131.     }
  132.  
  133.     IEnumerator ChoosingSuspect()
  134.     {
  135.         yield return new WaitForSeconds(0.9f);
  136.         mainCam.SetActive(false);
  137.         cutsceneCam.enabled = true;
  138.         playerIdle.SetActive(true);
  139.         player.GetComponent<SpriteRenderer>().enabled = false;
  140.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement