Beispiel #1
0
        private void SetActionButtons(DialogueNodeComponent dialogueNode)
        {
            if (dialogueNode.HasBranch)
            {
                foreach (DialogueTransitionNodeComponent transitionNode in dialogueNode.DialogueTransitions)
                {
                    // Create a button.
                    DialogueButton button = GameObject.Instantiate(_buttonPrefab) as DialogueButton;

                    button.ButtonText = transitionNode.DialogueTransitionData.TransitionText;

                    button.transform.SetParent(_buttonArea);
                    button.transform.localScale = Vector3.one;
                    button.IsTransition         = true;
                    button.TransitionNode       = transitionNode;
                    button.ButtonPressed.AddListener(ButtonPressed);
                    button.gameObject.SetActive(true);
                }
            }
            else
            {
                // Just do one button.
                DialogueButton button = GameObject.Instantiate(_buttonPrefab) as DialogueButton;
                button.ButtonText = "Continue...";
                button.transform.SetParent(_buttonArea);
                button.transform.localScale = Vector3.one;
                button.ButtonPressed.AddListener(ButtonPressed);
                button.gameObject.SetActive(true);
            }
        }
Beispiel #2
0
 private void ButtonPressed(DialogueButton button)
 {
     if (button.IsTransition)
     {
         if (OnDialogueBranchTaken != null)
         {
             OnDialogueBranchTaken(_currentNode, button.TransitionNode);
         }
     }
     else
     {
         if (OnDialogueViewProgressed != null)
         {
             OnDialogueViewProgressed(_currentNode);
         }
     }
 }