Пример #1
0
 public void HandleDialogueText(TextAsset text)
 {
     DetachCamera.Detach();
     GetComponent <CanvasGroup>().ChangeCanvasGroupVisibility(true);
     LoadFile(text);
     handlingText = StartCoroutine(_HandleDialogueText(text));
     Next();
 }
Пример #2
0
 public void StartNewText(TextAsset textAsset)
 {
     lockDialogue = false;
     if (handlingText != null)
     {
         StopCoroutine(handlingText);
     }
     ResetDialogueVariables();
     DetachCamera.Reattach();
     chapterProgress = -1;
     HandleDialogueText(textAsset);
 }
    void Update()
    {
        if (FindObjectOfType <ActivateMenu>().isPaused == false)
        {
            if (Input.GetKeyDown(KeyCode.Tab))
            {
                if (journalActive)
                {
                    DialogueController.lockDialogue = false;

                    DetachCamera.Reattach();
                    JournalCanvas.ChangeCanvasGroupVisibility(false);
                    journalActive = false;

                    if (DialogueController.instance.HandlingText == false)
                    {
                        Cursor.lockState = prevLock;
                        Cursor.visible   = prevCursorVisible;
                    }

                    sound.PlayOneShot(hideSound);
                }
                else
                {
                    DialogueController.lockDialogue = true;

                    DetachCamera.Detach();
                    JournalCanvas.ChangeCanvasGroupVisibility(true);
                    journalActive     = true;
                    prevLock          = Cursor.lockState;
                    prevCursorVisible = Cursor.visible;
                    Cursor.lockState  = CursorLockMode.None;
                    Cursor.visible    = true;
                    sound.PlayOneShot(showSound);
                }
            }
        }

        //if (journalActive)
        //{
        //    Cursor.lockState = CursorLockMode.None;
        //    Cursor.visible = true;
        //}
        //else
        //{
        //    Cursor.lockState = CursorLockMode.Locked;
        //    Cursor.visible = false;
        //}
    }
 public void Pause()
 {
     Menu.SetActive(true);
     isPaused = true;
     DetachCamera.Detach();
     prevCursorVisible               = Cursor.visible;
     prevLock                        = Cursor.lockState;
     Cursor.visible                  = true;
     Cursor.lockState                = CursorLockMode.None;
     journalAlpha                    = journalCanvasGroup.alpha;
     dialogueAlpha                   = dialogueCanvasGroup.alpha;
     dialogueCanvasGroup.alpha       = 0;
     journalCanvasGroup.alpha        = 0;
     DialogueController.lockDialogue = true;
 }
Пример #5
0
    private IEnumerator _HandleDialogueText(TextAsset text)
    {
        yield return(new WaitForEndOfFrame());


        while (data != null && chapterProgress < data.Count)
        {
            //Debug.Log("waiting for next in chapter file");

            if (_next && isHandlingLine == false)
            {
                string   line     = data[chapterProgress];
                LineType lineType = GetLineType(line);
                //Debug.Log(lineType.ToString());
                HandlingLineCoroutine = StartCoroutine(LineHandlers[lineType].HandleLine(line));
                sound.clip            = sounds[UnityEngine.Random.Range(0, sounds.Length - 1)];
                if (lineType != LineType.Choice)
                {
                    sound.Play();
                }
                while (isHandlingLine)
                {
                    yield return(new WaitForEndOfFrame());
                }
                sound.Stop();
                yield return(new WaitForEndOfFrame());
            }
            yield return(new WaitForEndOfFrame());
        }

        //Debug.Log("Progress: " + chapterProgress + " TOTAL: " + data.Count);

        while (!_next)
        {
            yield return(new WaitForEndOfFrame());
        }

        DetachCamera.Reattach();
        GetComponent <CanvasGroup>().ChangeCanvasGroupVisibility(false);
        ResetDialogueVariables();
        if (currentDialogueable != null)
        {
            currentDialogueable._interacting = false;
        }
        sound.Stop();
        currentDialogueable = null;
    }
    public void Resume() //resume game and hide menu
    {
        isPaused = false;
        Menu.SetActive(false);

        if (DialogueController.instance.HandlingText == false && JournalActivator.IsPaused == false)
        {
            Cursor.visible   = prevCursorVisible;
            Cursor.lockState = prevLock;
        }

        DetachCamera.Reattach();
        dialogueCanvasGroup.alpha = dialogueAlpha;
        journalCanvasGroup.alpha  = journalAlpha;

        DialogueController.lockDialogue = false;
    }
Пример #7
0
 private void Awake()
 {
     instance = this;
     firstPersonController = GetComponent <RigidbodyFirstPersonController>();
 }