Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class TriggerDialog9 : MonoBehaviour
- {
- public DialogManager dm;
- bool triggerable = true;
- public GameObject plr;
- public TriggerDialog4 td4;
- public TriggerDialog6 td6;
- public AudioSource asource1;
- public AudioSource asource2;
- public AudioSource asource3;
- public AudioSource ambiance;
- public Animator animator;
- public bool DEBUG = false;
- private void OnTriggerEnter(Collider other)
- {
- if (other.tag == "Player" && triggerable)
- {
- td4.continueDialog = false;
- td6.continueDialog = false;
- triggerable = false;
- startCutscene();
- Debug.Log("triggered");
- }
- }
- public void Update()
- {
- //DEBUG
- if (DEBUG)
- {
- if(Input.GetKeyDown(KeyCode.B))
- EndDialog();
- }
- if (DEBUG)
- {
- if (Input.GetKeyDown(KeyCode.N))
- {
- EndDialog();
- Transform plrtrans = plr.GetComponent<Transform>();
- plrtrans.position = new Vector3(plrtrans.position.x, 1.218f, plrtrans.position.z);
- }
- }
- }
- public void startCutscene()
- {
- ambiance.Stop();
- asource1.Play();
- Invoke("txt1", 3);
- }
- //dialogue
- public void txt1()
- {
- asource2.Play();
- dm.PopUp();
- dm.PlayText("Narrator: Ah, Penley, ever the curious one, ever the brilliant strategist. There was a chair right there, right within arm’s reach—a perfectly fine place to rest after all that wandering. But no, Penley couldn’t do the sensible thing.");
- Invoke("txt2", 12);
- }
- public void txt2()
- {
- dm.PlayText("Narrator: Instead, he turned away, eyes lighting up at the sight of an elevator tucked into the corner. An elevator! Because, of course, that’s what you need when you’re tired, isn’t it? Not rest. Not relief. Just... more distractions.");
- Invoke("txt3", 12);
- }
- public void txt3()
- {
- dm.PlayText("Narrator: Still, perhaps this isn’t the end. Maybe, somewhere on whatever floor he’s heading to, Penley will find a chair worthy of all this effort.");
- Invoke("txt4", 10f);
- }
- public void txt4()
- {
- dm.PlayText("Narrator: Yes, let’s hold on to that hope—for surely even Penley wouldn’t leave this journey empty-handed. Right?");
- Invoke("EndDialog", 8f);
- }
- //problematic script
- public void EndDialog()
- {
- animator.enabled = true;
- asource3.Play();
- asource2.Stop();
- Transform plrtrans = plr.GetComponent<Transform>();
- plrtrans.position = new Vector3(plrtrans.position.x, 29.218f, plrtrans.position.z);
- dm.Hide();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement