//Here I'm assigning the variable a new component of its required type void Start() { dialogue = gameObject.AddComponent <VIDE_Data>(); //Automatically adding the VIDE_Data component dialogue.OnActionNode += ActionHandler; //Subscribe to listen to triggered actions dialogue.OnLoaded += OnLoadedAction; //Subscribe dialogue.LoadDialogues(); //Load all dialogues to memory so that we dont spend time doing so later //Remember you can also manually add the VIDE_Data script as a component in the Inspector, //then drag&drop it on your 'dialogue' variable slot }
void Awake() { if (_instance) { Debug.LogError("Should not be 2 conversation ui managers in scene"); } _instance = this; _currentDialogue = gameObject.AddComponent <VIDE_Data>(); _currentDialogue.LoadDialogues(); }
void Start() { coolDownTimer = coolDown; positionIni = Mask.transform.position; position = Mask.transform.position; gameObject.AddComponent <VIDE_Data>(); VIDE_Data.LoadDialogues(); //Load all dialogues to memory so that we dont spend time doing so later VIDE_Data.BeginDialogue(GetComponent <VIDE_Assign>()); Photo = gameObject.GetComponentInChildren <CapturePhotoIntro>(true); npcText = gameObject.GetComponentInChildren <Text>(true); action = true; etape = 0; npcText.text = "Bonjour"; etatMask = 0; }
public override void OnInspectorGUI() { d = (VIDE_Data)target; GUIStyle b = new GUIStyle(GUI.skin.GetStyle("Label")); b.fontStyle = FontStyle.Bold; if (EditorApplication.isPlaying) { if (d.isLoaded) { GUILayout.Box("Active: " + d.diags[d.currentDiag].name, GUILayout.ExpandWidth(true)); } else { GUILayout.Box("No dialogue Active", GUILayout.ExpandWidth(true)); } scrollPos = EditorGUILayout.BeginScrollView(scrollPos, GUI.skin.GetStyle("Box"), GUILayout.ExpandWidth(true), GUILayout.Height(400)); for (int i = 0; i < d.diags.Count; i++) { if (!d.diags[i].loaded) { GUILayout.BeginHorizontal(); EditorGUILayout.LabelField(i.ToString() + ". " + d.diags[i].name + ": NOT LOADED"); if (d.isLoaded) { GUI.enabled = false; } if (GUILayout.Button("Load!")) { d.LoadDialogues(d.diags[i].name, ""); } GUI.enabled = true; GUILayout.EndHorizontal(); } else { EditorGUILayout.LabelField(i.ToString() + ". " + d.diags[i].name + ": LOADED", b); } } EditorGUILayout.EndScrollView(); EditorGUILayout.BeginHorizontal(); if (d.isLoaded) { GUI.enabled = false; } if (GUILayout.Button("Load All")) { d.LoadDialogues(); } if (GUILayout.Button("Unload All")) { d.UnloadDialogues(); } GUI.enabled = true; EditorGUILayout.EndHorizontal(); } else { GUILayout.Label("Enter PlayMode to display loaded/unloaded information"); } }
//Here I'm assigning the variable a new component of its required type void Start() { VIDE_Data.OnActionNode += ActionHandler; //Subscribe to listen to triggered actions VIDE_Data.OnLoaded += OnLoadedAction; //Subscribe VIDE_Data.LoadDialogues(); //Load all dialogues to memory so that we dont spend time doing so later }