Пример #1
0
        private void Start()
        {
            dialogue = GetComponent <DialogueBehaviour>();
            flow     = dialogue.Conversation;

            player = GameObject.FindWithTag("Player").transform;
        }
Пример #2
0
 /// <summary>
 /// Stops the given dialogue flow.
 /// </summary>
 /// <param name="dialogue"></param>
 public void StopDialogue(DialogueFlow dialogue)
 {
     if (dialogue.EVENT_NAME == AmbientDialogue.EVENT_NAME)
     {
         OnAmbientDialogueEnd();
     }
     else
     {
         OnEventFinished(dialogue.EVENT_NAME);
     }
 }
Пример #3
0
        /*   Camera _mainCamera;
         * Camera _activeCamera;
         *
         * /// <summary>
         * /// Sets the camera that the Conversation Flow should use.
         * /// </summary>
         * /// <param name="flow"></param>
         * void SetCamera(ConversationFlow flow, int index)
         * {
         *     if (flow.CameraController.Enable)
         *     {
         *         if (index == -1 || index > flow.CameraController.CameraList.Count)
         *             index = flow.CameraController.DefaultIndex;
         *
         *         _activeCamera.enabled = false;
         *
         *         Debug.Log("Camera index: " + index);
         *
         *         if (index < 0)
         *             _activeCamera = _mainCamera;
         *         else
         *         {
         *             index = Mathf.Min(index, flow.CameraController.CameraList.Count);
         *             _activeCamera = flow.CameraController.CameraList[index];
         *         }
         *         _activeCamera.enabled = true;
         *     }
         * }
         *
         * /// <summary>
         * /// Reset cameras to default: all turn off, except main camera.
         * /// </summary>
         * void ResetCamera(ConversationFlow flow)
         * {
         *     if (_mainCamera != null)
         *     {
         *         _mainCamera.enabled = true;
         *         _activeCamera = _mainCamera;
         *     }
         *
         *     if (flow.UseCustomCameras)
         *     {
         *         for (int cnt = 0; cnt < flow.ConversationCameras.Count; cnt++)
         *             flow.ConversationCameras[cnt].enabled = false;
         *     }
         * }*/
        #endregion

        /// <summary>
        /// Starts the dialogue with the given trigger mode, if it's allowed.
        /// </summary>
        /// <param name="dialogue"></param>
        /// <param name="mode"></param>
        public void StartDialogue(DialogueFlow dialogue, Trigger.Modes mode, Transform player = null)
        {
            if (dialogue.CheckTrigger(mode))
            {
                Player          = player;
                dialogue.Player = player;
                CallEvent(dialogue.EVENT_NAME);

                if (dialogue == Conversation && IsAmbientDialogueActive)
                {
                    StopDialogue(AmbientDialogue);
                }
            }
        }