private void Start() { player = PlayerManager.instance.Player.GetComponent <PlayerController>(); ourCollider = GetComponent <Collider>(); myWeap = DroppableObjects.instance.weaponList[lookupName]; trig = GetComponent <DialogueTrigger>(); }
// Use this for initialization void Awake() { manager = GameObject.Find("DialogueManager").GetComponent <DialogueManager>(); dialogue = gameObject.GetComponent <DialogueTrigger>().dialogue; trigger = gameObject.GetComponent <DialogueTrigger>(); controller = FindObjectOfType <UIController> (); }
IEnumerator triggerShatter() { yield return(new WaitForSeconds(1f)); dialogueTrigger = GetComponent <DialogueTrigger>(); dialogueTrigger.triggerDialogue(unlockAndEnd); }
private void Start() { chestAnim = GetComponent <Animator>(); chestAnim.enabled = false; dialogueTrigger = GetComponent <DialogueTrigger>(); }
public void EndDialogue() { InputManager.instance.disabled = false; if (currentDialogueTrigger.triggerOnEnter) //we only want the dialogues to automatically activate once, so the player doesn't get stuck in a dialogue loop { currentDialogueTrigger.triggerOnEnter = false; currentDialogueTrigger.triggerOnButtonPress = true; } InputManager.instance.actionInputDown = false; currentDialogueTrigger.dialogueActive = false; foreach (Animator anim in panelAnims) { anim.SetBool("panelActive", false); } nameAnim.SetBool("panelActive", false); dialogueAnim.SetBool("dialogueActive", false); if (currentDialogueTrigger.choicesAfterDialogue) { StartChoice(currentDialogueTrigger, currentDialogueTrigger.choices); currentDialogueTrigger.TriggerOutcome(currentDialogueTrigger.myEffects); currentDialogueTrigger = null; } else { currentDialogueTrigger.TriggerOutcome(currentDialogueTrigger.myEffects); currentDialogueTrigger = null; } }
void OnEnable() { myTransform = transform; dialogueTrigger = GetComponent <DialogueTrigger>(); agent = GetComponent <NavMeshAgent>(); timer = wanderTimer; }
private void Start() { player = null; dialogueTrigger = Dialogue.GetComponent <DialogueTrigger>(); dialogueManager = Dialogue.GetComponentInChildren <DialogueManager>(); tutorial.SetActive(false); }
// Start is called before the first frame update void Start() { _myDialogueTrigger = gameObject.GetComponent <DialogueTrigger>(); _myDialogue = _myDialogueTrigger.dialogue; gateAL.enabled = false; gateAR.enabled = false; }
protected override void Init() { this.name = "Puzzle Solving Cutscene"; dialogueTrigger = GetComponent <DialogueTrigger> (); dialogueManager = GameObject.Find("DialogueManager").GetComponent <DialogueManager> (); base.Init(); }
void OnTriggerStay2D(Collider2D col) { if (col.gameObject.name == "Player" && !disabled && !locked) { FindObjectOfType <PlayerControl>().setInteractTooltip(); if (Input.GetButtonDown("Fire1")) { FindObjectOfType <PlayerControl>().unsetInteractTooltip(); locked = true; if (hasDialogue) { dialogueTrigger = GetComponent <DialogueTrigger>(); dialogueTrigger.triggerDialogue(endAction); if (disabledAfterInteract) { disabled = true; } } animator.Play("Open"); } } }
private void AssignDialogueManager(DialogueTrigger dialogueTrigger) { if (dialogueTrigger.dialogueManager == null) { dialogueTrigger.dialogueManager = gameManager.dialogueManager; } }
private void Start() { image = GetComponent <Image>(); origPos = transform.position; player = FindObjectOfType <Player>(); cursor = FindObjectOfType <CursorManager>(); boxCol = GetComponent <BoxCollider2D>(); dt = GameObject.FindGameObjectWithTag("IndivDialogueThing").GetComponent <DialogueTrigger>(); if (isInSlot) { GetComponent <Image>().enabled = true; if (boxCol != null) { boxCol.enabled = true; } } else { GetComponent <Image>().enabled = false; if (boxCol != null) { boxCol.enabled = false; } } }
/// <summary> /// Play any class-specific dialogue for the required action before playing the exit dialogue /// </summary> public void PlayClassSpecificDialogue() { if (playerClasses.Count > 1) { DialogueTrigger curr = GetClassSpecificDialogue(playerClasses[0]); DialogueTrigger next = null; curr.TriggerDialogue(); // adds event listeners that link together all class specific dialogue for (int i = 1; i < playerClasses.Count; i++) { next = GetClassSpecificDialogue(playerClasses[i]); // When the current dialogue completes, the next dialogue will play curr.dialogue.onComplete.AddListener(next.TriggerDialogue); curr = next; } next.dialogue.onComplete.AddListener(requiredActions[currentAction + 1].exitDialogueTrigger.TriggerDialogue); } else if (playerClasses.Count == 1) { // if there's only one player then trigger the exit dialogue (will only ever happen in testing) DialogueTrigger curr = GetClassSpecificDialogue(playerClasses[0]); curr.dialogue.onComplete.AddListener(requiredActions[currentAction + 1].exitDialogueTrigger.TriggerDialogue); curr.TriggerDialogue(); } else { // if there's no class-specific dialogue then just play the exit dialogue requiredActions[currentAction + 1].exitDialogueTrigger.TriggerDialogue(); } }
void Start() { // Get reference to Player Game Object GameObject playerGameObject = GameObject.FindGameObjectWithTag("Player"); playerScript = playerGameObject.GetComponent <Player>(); // Get reference to Dialogue Manager Game Object dialogueManagerGO = GameObject.Find("DialogueManager"); // Get reference Dialogue Trigger script GameObject dTrigger; if (GameManager.instance.level == 1) { dTrigger = GameObject.Find("DialogueTrigger1"); trigger = dTrigger.GetComponent <DialogueTrigger>(); } if (GameManager.instance.level == 2) { dTrigger = GameObject.Find("DialogueTrigger2"); trigger = dTrigger.GetComponent <DialogueTrigger>(); } //// Get reference Dialogue Trigger script //GameObject dTrigger = GameObject.Find("DialogueTrigger"); //trigger = dTrigger.GetComponent<DialogueTrigger>(); }
private void OnTriggerEnter2D(Collider2D collision) { if (collision.tag == "Interactable") { chr = collision.GetComponent <DialogueTrigger>(); } }
public void StartDialogue(Dialogue dialogue, GameObject popup, DialogueTrigger trigger) { DialogueCameraOn(); dialoguePopup = popup; context = trigger; StartCoroutine("DialoguePromptFadeIn"); nameText = dialoguePopup.GetComponentsInChildren <Text>()[0]; dialogueText = dialoguePopup.GetComponentsInChildren <Text>()[1]; sentences.Clear(); nameText.text = dialogue.name; foreach (string sentence in dialogue.sentences) { sentences.Enqueue(sentence); } coroutineList = new List <Coroutine>(); DisplayNextSentence(); }
private void OnTriggerExit2D(Collider2D collision) { if (collision.tag == "Interactable") { chr = null; } }
IEnumerator Run() { greg.color = Color.white; player.enabled = false; for (int i = 0; i < 30; i++) { yield return(null); } DialogueTrigger trigger = GetComponent <DialogueTrigger>(); trigger.Trigger("cutscene"); yield return(new WaitUntil(() => trigger.GetIndex > 3)); trigger.pause = true; FadeManager.FadeToColor(Color.black, 120); for (int i = 0; i < 110; i++) { yield return(null); } FadeManager.FadeToColor(Color.clear, 30); Stairs.spawn = new Vector3(-1.6f, 11.2f); SceneManager.LoadScene("Floor 3"); }
// Update is called once per frame void Update() { // if the trigger has fired if (triggered) { // reduce time left triggerTimeGone += Time.deltaTime; // check if time is up if (triggerTimeGone >= triggerTimer) { // trigger the object destruction GameObject.Destroy(GameObject.Find(objectName)); // trigger some dialogue if necessary if (dialogueTriggerName != "") { DialogueTrigger.TriggerDialogue(dialogueTriggerName); } // self destruct GameObject.Destroy(gameObject); } } }
// Use this for initialization void Start() { karmaAffected = false; noteText = GameObject.Find("NoteText").GetComponent <Text>(); RC = FindObjectOfType <ReactionController> (); DT = GetComponent <DialogueTrigger> (); }
public void ColisionHandling(RaycastHit2D hit, Vector3 end) { if (hit.transform.tag == "Lever") { Lever lever = hit.transform.GetComponent <Lever>(); lever.state = !lever.state; } if (hit.transform.tag == "Dialogue Trigger") { DialogueTrigger dialogueTrigger = hit.transform.GetComponent <DialogueTrigger>(); dialogueTrigger.TriggerDialogue(); } if (hit.transform.tag == "Key") { Key pickedUpKey = hit.transform.GetComponent <Key>(); pickedUpKey.OnPickUp(); keyChain.Add(pickedUpKey); rb2D.MovePosition(end); } if (hit.transform.tag == "LockedDoor") { InvisibleDoor_Key door_Key = hit.transform.GetComponent <InvisibleDoor_Key>(); door_Key.tryToOpen(keyChain); } }
// Get a random movie. void ChooseMovie() { bool movieChosen = false; int id = -1; while (movieChosen == false) { id = Random.Range(0, movies.Count - 1); if (usedMovies == null) { usedMovies = new List <int> (); } movieChosen = usedMovies.Contains(id) == false; } //print ("movie chosen:"); //print (id); id = 0; targetMovie = movies [id]; DialogueTrigger prompt = prompt_button.GetComponent <DialogueTrigger> (); prompt.dialogue.sentences = targetMovie.GetComponent <MovieScript> ().prompt; if (targetMovie.GetComponent <MovieScript>().Id == -1) { Debug.Log("ERROR: Choosing movie failed. Is something wrong with the chosen movie?"); Debug.Break(); } if (usedMovies.Contains(id)) { // Debug.Log("ERROR: This movie has already been chosen. Did you forget to add it to the usedMovies list?"); // Debug.Break (); } usedMovies.Add(id); }
private void Start() { tempPosition = new Vector3(); boxCollider = GetComponent <BoxCollider>(); dt = GetComponent <DialogueTrigger>(); }
public void TakeAction(PlayerMovementController movementController, Inventory inventory) { // Check for key if (doorKey > KeyType.UNLOCKED) { Debug.Log("Door is locked! Key type: " + doorKey); if (inventory.HasKey(doorKey)) { // Unlock the door, change the door state // TODO: Play an unlock sfx doorKey = KeyType.UNLOCKED; SetOpenState(!isOpen); } else { Debug.Log("No key! Attempting to display message"); DialogueTrigger dialogue = gameObject.GetComponent <DialogueTrigger>(); dialogue.TriggerDialogue(movementController); } } else { // No lock, change the door state SetOpenState(!isOpen); } }
void Update() { // If return key is pressed... if (Input.GetKeyUp(KeyCode.Space)) { // open next dialogue DialogueManager dialogueManager = GameObject.Find("DialogueManager").GetComponent <DialogueManager> (); dialogueManager.DisplayNextSentence(); } if (Input.GetKeyUp(KeyCode.Q)) { // open interaction options InteractionsHandler interactionHandler = GameObject.Find("InteractionsHandler").GetComponent <InteractionsHandler>(); if (interactionHandler.getState()) { string interactionType = interactionHandler.getType(); string interactionName = interactionHandler.getObjectName(); if (interactionType == "dialogue") { DialogueTrigger trigger = GameObject.Find(interactionName).GetComponent <DialogueTrigger>(); trigger.TriggerDialogue(); } else if (interactionType == "") { // run associated function } } } }
// Use this for initialization void Start() { sentences = new Queue <string>(); _dialogueTrigger = GetComponent <DialogueTrigger>(); _dialogueTrigger.TriggerDialogue(); _continueButton = GameObject.FindWithTag(Values.ContinueButtonTag); }
void Start() { DialogueTrigger diaTrigger = gameObject.GetComponent <DialogueTrigger>(); startConversationText.text = "Press [E] to start talking"; startConversationText.gameObject.SetActive(false); }
void Start() { dialogueTrigger = GetComponentInParent <DialogueTrigger>(); sentences = new Queue <string>(); dialogueTrigger.gameObject.SetActive(false); }
public void StartChoice(DialogueTrigger dialogueTrigger, Choice[] choices) { currentDialogueTrigger = dialogueTrigger; currentDialogueTrigger.choicesActive = true; if (choices.Length > choiceTexts.Length) { Debug.Log("too many choices"); return; } for (int i = choices.Length; i > 0; i--) { if (choices[i - 1].choiceLabel != "") { if (InputManager.instance.activeInputScript == InputManager.instance.XboxControles) { choiceSprites[i - 1].color = xBoxColors[i - 1]; } else { choiceSprites[i - 1].color = PS4Colors[i - 1]; } choiceFrameAnimators[i - 1].SetBool("panelActive", true); choiceTextAnimators[(i - 1)].SetBool("panelActive", true); choiceSpriteAnimators[(i - 1)].SetBool("panelActive", true); StartCoroutine(TypeSentence(choices[i - 1].choiceLabel, choiceTexts[i - 1])); } StartCoroutine(MakeAChoice(currentDialogueTrigger)); } }
private void RayFire() { //print("RAY"); if (!wantsToTarget) { return; } if (target == null) { return; } if (!CanSeeThing(target)) { return; } //shoot a ray into the scene Ray ray = new Ray(cam.transform.position, cam.transform.forward); RaycastHit hit; Debug.DrawRay(ray.origin, ray.direction, Color.black, 100f); if (Physics.Raycast(ray, out hit)) { //raycast hit controller in scene if (dialogueSystem.inConversation == false) { DialogueTrigger dialogueTrigger = hit.transform.GetComponent <DialogueTrigger>(); if (dialogueTrigger != null) { dialogueTrigger.TriggerDialogue(); } } } }