Advertisement
jretchy

Untitled

May 17th, 2022
465
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  [Header("Timelines")]
  2.     public PlayableDirector enoughStreewise;
  3.     public PlayableDirector notEnoughStreewise;
  4.  
  5.     [Header("Cameras")]
  6.     public Camera mainCam;
  7.     public Camera cutsceneCam;
  8.  
  9.     [Header("In-Game Assets")]
  10.     public GameObject playerIdle;
  11.     public GameObject civilianBubble;
  12.     public Canvas civilianBubbleCanvas;
  13.     private GameObject player;
  14.     private GameObject text;
  15.     private GameObject notEnoughStreetPoints;
  16.  
  17.     private void Start()
  18.     {
  19.         player = GameObject.Find("Player");
  20.         text = GameObject.Find("Main Camera/ExtraUI/TalkToCivilian");
  21.         notEnoughStreetPoints = GameObject.Find("Main Camera/ExtraUI/NotEnoughStreet");
  22.  
  23.         playerIdle.SetActive(false);
  24.         text.SetActive(false);
  25.         civilianBubble.SetActive(true);
  26.         civilianBubbleCanvas.enabled = true;
  27.  
  28.         cutsceneCam.enabled = false;
  29.     }
  30.  
  31.     private void OnTriggerEnter2D(Collider2D col)
  32.     {
  33.         if (col.gameObject.CompareTag("Player"))
  34.         {
  35.             text.SetActive(true);
  36.         }
  37.     }
  38.  
  39.     private void OnTriggerExit2D(Collider2D col)
  40.     {
  41.         if (col.gameObject.CompareTag("Player"))
  42.         {
  43.             text.SetActive(false);
  44.         }
  45.     }
  46.  
  47.     private void Update()
  48.     {
  49.         if (text.activeInHierarchy == true && Input.GetKeyDown(KeyCode.E) && Street_Skill.Street < 4)
  50.         {
  51.             notEnoughStreewise.Play();
  52.             text.SetActive(false);
  53.             StartCoroutine(NotEnoughPoints());
  54.         }
  55.  
  56.         if (text.activeInHierarchy == true && Input.GetKeyDown(KeyCode.E) && Street_Skill.Street >= 4)
  57.         {
  58.             enoughStreewise.Play();
  59.             text.SetActive(false);
  60.             StartCoroutine(EnoughPoints());
  61.         }
  62.  
  63.         if (FindObjectOfType<PlayerMovement>().talkedToCivilian == true)
  64.         {
  65.             this.gameObject.SetActive(false);
  66.             civilianBubble.SetActive(false);
  67.             civilianBubbleCanvas.enabled = false;
  68.         }
  69.     }
  70.  
  71.     IEnumerator NotEnoughPoints()
  72.     {
  73.         yield return new WaitForSeconds(0.9f);
  74.         playerIdle.SetActive(true);
  75.         cutsceneCam.enabled = true;
  76.         mainCam.enabled = false;
  77.         player.GetComponent<SpriteRenderer>().enabled = false;
  78.         civilianBubble.GetComponent<SpriteRenderer>().enabled = false;
  79.         civilianBubbleCanvas.enabled = false;
  80.  
  81.         cutsceneCam.GetComponent<AudioListener>().enabled = true;
  82.         mainCam.GetComponent<AudioListener>().enabled = false;
  83.  
  84.         yield return new WaitForSeconds(17.7833333333333f);
  85.         playerIdle.SetActive(false);
  86.         cutsceneCam.enabled = false;
  87.         mainCam.enabled = true;
  88.         player.GetComponent<SpriteRenderer>().enabled = true;
  89.         civilianBubble.GetComponent<SpriteRenderer>().enabled = true;
  90.         civilianBubbleCanvas.enabled = true;
  91.  
  92.         cutsceneCam.GetComponent<AudioListener>().enabled = false;
  93.         mainCam.GetComponent<AudioListener>().enabled = true;
  94.  
  95.         yield return new WaitForSeconds(1);
  96.         notEnoughStreetPoints.GetComponent<Animator>().SetBool("ReportBack", true);
  97.  
  98.         yield return new WaitForSeconds(11);
  99.         notEnoughStreetPoints.GetComponent<Animator>().SetBool("ReportBack", false);
  100.     }
  101.  
  102.  
  103.     IEnumerator EnoughPoints()
  104.     {
  105.         yield return new WaitForSeconds(0.9f);
  106.         playerIdle.SetActive(true);
  107.         cutsceneCam.enabled = true;
  108.         mainCam.enabled = false;
  109.         player.GetComponent<SpriteRenderer>().enabled = false;
  110.         civilianBubble.GetComponent<SpriteRenderer>().enabled = false;
  111.         civilianBubbleCanvas.enabled = false;
  112.  
  113.         cutsceneCam.GetComponent<AudioListener>().enabled = true;
  114.         mainCam.GetComponent<AudioListener>().enabled = false;
  115.  
  116.         yield return new WaitForSeconds(67.3333333333333f);
  117.         playerIdle.SetActive(false);
  118.         cutsceneCam.enabled = false;
  119.         mainCam.enabled = true;
  120.         player.GetComponent<SpriteRenderer>().enabled = true;
  121.         this.gameObject.GetComponent<BoxCollider2D>().enabled = false;
  122.  
  123.         FindObjectOfType<PlayerMovement>().talkedToCivilian = true;
  124.  
  125.         cutsceneCam.GetComponent<AudioListener>().enabled = false;
  126.         mainCam.GetComponent<AudioListener>().enabled = true;
  127.     }
  128.  
Advertisement
RAW Paste Data Copied
Advertisement