Ejemplo n.º 1
0
 private void Start()
 {
     player      = PlayerManager.instance.Player.GetComponent <PlayerController>();
     ourCollider = GetComponent <Collider>();
     myWeap      = DroppableObjects.instance.weaponList[lookupName];
     trig        = GetComponent <DialogueTrigger>();
 }
Ejemplo n.º 2
0
 // Use this for initialization
 void Awake()
 {
     manager    = GameObject.Find("DialogueManager").GetComponent <DialogueManager>();
     dialogue   = gameObject.GetComponent <DialogueTrigger>().dialogue;
     trigger    = gameObject.GetComponent <DialogueTrigger>();
     controller = FindObjectOfType <UIController> ();
 }
Ejemplo n.º 3
0
    IEnumerator triggerShatter()
    {
        yield return(new WaitForSeconds(1f));

        dialogueTrigger = GetComponent <DialogueTrigger>();
        dialogueTrigger.triggerDialogue(unlockAndEnd);
    }
Ejemplo n.º 4
0
    private void Start()
    {
        chestAnim         = GetComponent <Animator>();
        chestAnim.enabled = false;

        dialogueTrigger = GetComponent <DialogueTrigger>();
    }
Ejemplo n.º 5
0
    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;
        }
    }
Ejemplo n.º 6
0
 void OnEnable()
 {
     myTransform     = transform;
     dialogueTrigger = GetComponent <DialogueTrigger>();
     agent           = GetComponent <NavMeshAgent>();
     timer           = wanderTimer;
 }
Ejemplo n.º 7
0
 private void Start()
 {
     player          = null;
     dialogueTrigger = Dialogue.GetComponent <DialogueTrigger>();
     dialogueManager = Dialogue.GetComponentInChildren <DialogueManager>();
     tutorial.SetActive(false);
 }
Ejemplo n.º 8
0
 // Start is called before the first frame update
 void Start()
 {
     _myDialogueTrigger = gameObject.GetComponent <DialogueTrigger>();
     _myDialogue        = _myDialogueTrigger.dialogue;
     gateAL.enabled     = false;
     gateAR.enabled     = false;
 }
Ejemplo n.º 9
0
 protected override void Init()
 {
     this.name       = "Puzzle Solving Cutscene";
     dialogueTrigger = GetComponent <DialogueTrigger> ();
     dialogueManager = GameObject.Find("DialogueManager").GetComponent <DialogueManager> ();
     base.Init();
 }
Ejemplo n.º 10
0
    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");
            }
        }
    }
Ejemplo n.º 11
0
 private void AssignDialogueManager(DialogueTrigger dialogueTrigger)
 {
     if (dialogueTrigger.dialogueManager == null)
     {
         dialogueTrigger.dialogueManager = gameManager.dialogueManager;
     }
 }
Ejemplo n.º 12
0
 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;
         }
     }
 }
Ejemplo n.º 13
0
 /// <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();
     }
 }
Ejemplo n.º 14
0
    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>();
    }
Ejemplo n.º 15
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.tag == "Interactable")
     {
         chr = collision.GetComponent <DialogueTrigger>();
     }
 }
Ejemplo n.º 16
0
    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();
    }
Ejemplo n.º 17
0
 private void OnTriggerExit2D(Collider2D collision)
 {
     if (collision.tag == "Interactable")
     {
         chr = null;
     }
 }
Ejemplo n.º 18
0
    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");
    }
Ejemplo n.º 19
0
    // 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);
            }
        }
    }
Ejemplo n.º 20
0
 // Use this for initialization
 void Start()
 {
     karmaAffected = false;
     noteText      = GameObject.Find("NoteText").GetComponent <Text>();
     RC            = FindObjectOfType <ReactionController> ();
     DT            = GetComponent <DialogueTrigger> ();
 }
Ejemplo n.º 21
0
 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);
     }
 }
Ejemplo n.º 22
0
    // 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);
    }
Ejemplo n.º 23
0
    private void Start()
    {
        tempPosition = new Vector3();

        boxCollider = GetComponent <BoxCollider>();
        dt          = GetComponent <DialogueTrigger>();
    }
Ejemplo n.º 24
0
 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);
     }
 }
Ejemplo n.º 25
0
    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
                }
            }
        }
    }
Ejemplo n.º 26
0
 // Use this for initialization
 void Start()
 {
     sentences        = new Queue <string>();
     _dialogueTrigger = GetComponent <DialogueTrigger>();
     _dialogueTrigger.TriggerDialogue();
     _continueButton = GameObject.FindWithTag(Values.ContinueButtonTag);
 }
Ejemplo n.º 27
0
    void Start()
    {
        DialogueTrigger diaTrigger = gameObject.GetComponent <DialogueTrigger>();

        startConversationText.text = "Press [E] to start talking";
        startConversationText.gameObject.SetActive(false);
    }
Ejemplo n.º 28
0
    void Start()
    {
        dialogueTrigger = GetComponentInParent <DialogueTrigger>();
        sentences       = new Queue <string>();

        dialogueTrigger.gameObject.SetActive(false);
    }
Ejemplo n.º 29
0
    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));
        }
    }
Ejemplo n.º 30
0
    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();
                }
            }
        }
    }