コード例 #1
0
    /**
     * Starts a dialog
     * @param List<string>  dialog                                  An list of sentences to display
     * @param callback      onDialogCloseCallback   (optionnal)     A callback function once the last sentence has been skiped
     * @param bool          isChained               (optionnal)     True if called inside a process involving player's control (like a cinematic)
     */
    public void StartDialog(List <string> dialog, onDialogClose onDialogCloseCallback = null, bool isChained = false)
    {
        onDialogClose onDialogClose         = null;
        bool          hasNpcMovementManager = GetComponentInParent <NPCMovementManager>() != null;

        DialogManager.isReading = true;

        if (hasNpcMovementManager)
        {
            GetComponentInParent <NPCMovementManager>().InterruptMoving();
        }

        onDialogClose = delegate() {
            if (!isChained)
            {
                playerController.UnrestrainPlayer();
                playerController.Unimmobilize();
            }

            if (hasNpcMovementManager)
            {
                transform.parent.GetComponent <NPCMovementManager>().StartMovingRandomly();
            }
            DialogManager.isReading = false;
            if (onDialogCloseCallback != null)
            {
                onDialogCloseCallback();
            }
        };

        if (!isChained)
        {
            playerController.RestrainPlayer();
            playerController.Immobilize();
        }

        dialogManager.OpenDialog(dialog, onDialogClose);
    }
コード例 #2
0
 public void OpenDialog(List <string> text, onDialogClose dialogCloseCallback = null)
 {
     onDialogCloseCallback = dialogCloseCallback;
     texts = text;
     _OpenDialog();
 }
コード例 #3
0
 public void OpenDialog(string text, onDialogClose dialogCloseCallback = null)
 {
     onDialogCloseCallback = dialogCloseCallback;
     texts.Add(text);
     _OpenDialog();
 }