Hoping to get feedback for a better understanding of our structure

Please check out this DialogueTrigger.cs

Read the comments and PLEASE
correct me where I am wrong
Thanks!

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;

namespace RPG.Dialogue
{
    public class DialogueTrigger : MonoBehaviour
    {
        // The purpose of this script is to allow user to add an action to any gameObject
        // (currently a string that can be used to MATCH the dialogue Nodes (onEnterAction or onExitAction) events
        // I plan on changing this to an enum)
        // this allows the designer(user) to choose from Unity drop down of
        // functions to call based on gameObject dragged into it (that unity event from Inspector) 
        // (can also be this object -- meaning the one this script is on)
        //
        // In our class we added it(this script) to Enemy 6 in inspector
        // In our dialogue I added Attack to the onEnterAction of the last node (of the wrong path made guard angry)
        // On Enemy 6 Hit plus sign drug Enemies Parent into Game Object (it has a Aggro Group script 
        // to activate all enemies attack again)
        // Hit plus to add another event
        // drug Player into game object slot
        // choose PlayerConversant.Quit to close the dialogue

        [SerializeField] string actionFromDialogueNode; // Makes it clearer to my designer
        [SerializeField] UnityEvent onTrigger;

        public void Trigger(string actionToTrigger) 
        {
            // Seems like actionThatTriggers would be a better name here
            // am i correct in thinking the string name only has to match
            // the DialogueNode and the string the designer enters in this component(actionFromDialogueNode)??????
            // if they match then the unity event onTrigger will fire 
            // based on the gameObject that the Designer pulled into this component??
            // Thanks for helping me understand
            if (actionToTrigger == actionFromDialogueNode)
            {
                onTrigger?.Invoke(); // This will invoke the selected unity click event from Inspector
            }
        }

    }
}

Thanks for your help

1 Like

Steve, I must say, you often post that you’re having difficulty with the way things are explained, but ultimately, you’re understanding this very well.

Thanks For the vote of confidence.

Actually I have written VBA apps that have gone Region wide for Centex Homes.

I have found that planning the help files for all concerned limits the number of calls I get.

I have had to watch these videos more than I like to admit. sometimes at slow speed sometimes at fast speed.

But you are correct I get some of it.

My biggest problem right now is writing the help for my designers
that tie between Unity and the scripts we have been writing.

How to’s for putting the scripts to use within the editor. ( I am very weak on this till for now)

Privacy & Terms