//This begins the conversation (Called by examplePlayer script) public void Begin(VIDE_Assign diagToLoad) { //First step is to call BeginDialogue, passing the required 'DialogueAssign' component //This will store the first Node data in dialogue.nodeData dialogue.BeginDialogue(diagToLoad); //Let's clean the NPC text variables npcText.text = ""; npcName.text = ""; //If we already talked to this NPC, lets modify the start of the conversation if (dialogue.assigned.interactionCount > 0 && gotItem) { string name = dialogue.assigned.dialogueName; switch (name) { case "Crazy Cap": dialogue.nodeData = dialogue.SetNode(17); break; } } //Everytime dialogue.nodeData gets updated, we update our UI with the new data UpdateUI(); }
//This begins the conversation (Called by examplePlayer script) public void Begin(VIDE_Assign diagToLoad) { //First step is to call BeginDialogue, passing the required VIDE_Assign component //This will store the first Node data in dialogue.nodeData dialogue.BeginDialogue(diagToLoad); //Safety check in case a null dialogue was sent if (dialogue.assigned == null) { dialogue.EndDialogue(); return; } //Let's clean the NPC text variables npcText.text = ""; npcName.text = ""; //If we already talked to this NPC, lets modify the start of the conversation //Of course, this will be true for particular cases //Here, we are using the dialogueName variable of the VIDE_Assign to compare if (dialogue.assigned.interactionCount > 0 || LocalDataSingleton.instance.talkedToDragon) { string name = dialogue.assigned.dialogueName; switch (name) { case "Dragon": dialogue.nodeData = dialogue.SetNode(30); //SetNode allows you to jump to whichever node you want if (!LocalDataSingleton.instance.talkedToDragon) { LocalDataSingleton.instance.talkedToDragon = true; } break; } } var data = dialogue.nodeData; //Let's specifically check for dynamic text change if (!data.currentIsPlayer && data.extraData.Equals("itemLookUp")) { ItemLookUp(data); } else if (!data.currentIsPlayer && data.extraData.Equals("RelicLookUp")) { RelicLookUp(data); } //Everytime dialogue.nodeData gets updated, we update our UI with the new data UpdateUI(); }
public void StartConversation(VIDE_Assign diagToLoad) { if (_currentDialogue.isActiveAndEnabled) { return; } _currentDialogue.OnActionNode += ActionHandler; _currentDialogue.OnNodeChange += NodeChangeAction; _currentDialogue.OnEnd += EndConversation; SetPlayerControllerActive(false); UIRoot.SetActive(true); _currentDialogue.BeginDialogue(diagToLoad); }
public void Begin(VIDE_Assign diagToLoad) { inConversation = true; aiDialogue.text = ""; playerDialogue.text = ""; VIDE_Data.OnActionNode += ActionHandler; VIDE_Data.OnNodeChange += NodeChangeAction; VIDE_Data.OnEnd += EndDialogue; //SpecialStartNodeOverrides(diagToLoad); //This one checks for special cases when overrideStartNode could change right before starting a conversation VIDE_Data.BeginDialogue(diagToLoad); //Begins conversation, will call the first OnNodeChange uiContainer.SetActive(true); }
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; }
//This begins the conversation (Called by examplePlayer script) public void Begin(VIDE_Assign diagToLoad) { //Let's clean the NPC text variables npcText.text = ""; npcName.text = ""; //First step is to call BeginDialogue, passing the required VIDE_Assign component //This will store the first Node data in VIDE_Data.nodeData //But before we do so, let's subscribe to certain events that will allow us to easily //Handle the node-changes VIDE_Data.OnActionNode += ActionHandler; VIDE_Data.OnNodeChange += NodeChangeAction; VIDE_Data.OnEnd += EndDialogue; SpecialStartNodeOverrides(diagToLoad); //This one checks for special cases when overrideStartNode could change right before starting a conversation VIDE_Data.BeginDialogue(diagToLoad); //Begins conversation, will call the first OnNodeChange uiContainer.SetActive(true); }
void OnGUI() { if (dialogue.isLoaded) { var data = dialogue.nodeData; //Quick reference if (data.currentIsPlayer) // If it's a player node, let's show all of the available options as buttons { for (int i = 0; i < data.playerComments.Length; i++) { if (GUILayout.Button(data.playerComments[i])) //When pressed, set the selected option and call Next() { data.selectedOption = i; dialogue.Next(); } } } else //if it's a NPC node, Let's show the comment and add a button to continue { GUILayout.Label(data.npcComment[data.npcCommentIndex]); if (GUILayout.Button(">")) { dialogue.Next(); } if (data.isEnd) // If it's the end, let's just call EndDialogue { dialogue.EndDialogue(); } } } else // Add a button to begin conversation if it isn't started yet { if (GUILayout.Button("Start Convo")) { dialogue.BeginDialogue(GetComponent <VIDE_Assign>()); //We've attached a DialogueAssign to this same gameobject, so we just call the component } } }
void OnGUI() { GUILayout.BeginArea(new Rect(1000, 100, 200, 200)); if (VIDE_Data.isLoaded) { var data = VIDE_Data.nodeData; //Quick reference if (data.currentIsPlayer) // If it's a player node, let's show all of the available options as buttons { for (int i = 0; i < data.playerComments.Length; i++) { /* string debug = etape.ToString(); * timer.timerText.text = debug; * * if (etape == 1) * { * timer.timerText.color = Color.yellow; * } * else * { * timer.timerText.color = Color.black; * } */ // Choisis dans la liste des émotions celle qui sera choisis, ici ça se traduit avec un bouton du nom de l'émotion if (GUILayout.Button(data.playerComments[i])) //When pressed, set the selected option and call Next() { data.selectedOption = i; // selectionne la valeur du bouton et l'intégre dans la variable data Debug.Log("i =" + i); Photo.TakePhoto(); //Prend une photo // Lance la fonction choixVideo du script Jouervideo. VIDE_Data.Next(); // passe au texte suivant etape++; action = true; // CoolDown.CoolDownActive(); } } // Choix du dialogue en appuyant sur une touche if (Input.GetKeyDown(KeyCode.Keypad1)) { Debug.Log("data =" + data.selectedOption); Photo.TakePhoto(); } if (Input.GetKeyDown(KeyCode.Keypad2)) { data.selectedOption = 2; //Choix 2 Debug.Log("data =" + data.selectedOption); VIDE_Data.Next(); } } else //if it's a NPC node, Let's show the comment and add a button to continue { if (action == true) // on ne teste qu'une fois l'émotion { Debug.Log("Valeur action" + action); Debug.Log("ExtraVar" + data.extraVars.ContainsKey("Peur")); //Emotion Peur if (data.extraVars.ContainsKey("Peur")) //Si l'emotion choisi est la peur. { EmotionTest = "Peur"; Dictionary <string, object> newVars = data.extraVars; //Clone the current extraVars content newItem = (int)newVars["Peur"]; //Retrieve the value we want to change Debug.Log("Valeur NewItem avant incrément" + newItem); // newItem += 2; //Change it as we desire // Debug.Log("Valeur NewItem" + newItem); // newVars["Peur"] = newItem; //Set it back // VIDE_Data.UpdateExtraVariables(2, newVars); //Send newVars through UpdateExtraVariable method } //Emotion Colere if (data.extraVars.ContainsKey("Colere") && action == true) //Si l'emotion choisi est la Colere. { EmotionTest = "Colere"; Dictionary <string, object> newVars = data.extraVars; newItem = (int)newVars["Colere"]; Video.ChoixVideo(); action = false; } //Emotion Joie if (data.extraVars.ContainsKey("Joie")) { EmotionTest = "Joie"; Dictionary <string, object> newVars = data.extraVars; newItem = (int)newVars["Joie"]; action = false; } //Emotion Tristesse if (data.extraVars.ContainsKey("Tristesse")) { EmotionTest = "Tristesse"; Dictionary <string, object> newVars = data.extraVars; newItem = (int)newVars["Tristesse"]; action = false; } //Emotion Tristesse if (data.extraVars.ContainsKey("Tristesse")) { EmotionTest = "Tristesse"; Dictionary <string, object> newVars = data.extraVars; newItem = (int)newVars["Tristesse"]; action = false; } //Emotion Dégout if (data.extraVars.ContainsKey("Degout")) { EmotionTest = "Degout"; Dictionary <string, object> newVars = data.extraVars; newItem = (int)newVars["Degout"]; action = false; } //Emotion Surprise if (data.extraVars.ContainsKey("Surprise")) { EmotionTest = "Surprise"; Dictionary <string, object> newVars = data.extraVars; newItem = (int)newVars["Surprise"]; action = false; } //Emotion Neutre if (data.extraVars.ContainsKey("Neutre")) { EmotionTest = "Neutre"; Dictionary <string, object> newVars = data.extraVars; newItem = (int)newVars["Neutre"]; action = false; } } // on ajout un bouton pour pouvoir passer à la suite GUILayout.Label(data.npcComment[data.npcCommentIndex]); Debug.Log("Valeur" + data.npcComment[data.npcCommentIndex]); if (GUILayout.Button(">")) { VIDE_Data.Next(); } if (CoolDown.Next == true) { VIDE_Data.Next(); CoolDown.Next = false; } // On ajoute un timer pour lancer la suite } if (data.isEnd) // If it's the end, let's just call EndDialogue { VIDE_Data.EndDialogue(); } } else // Add a button to begin conversation if it isn't started yet { if (GUILayout.Button("Start Convo")) { VIDE_Data.BeginDialogue(GetComponent <VIDE_Assign>()); //We've attached a DialogueAssign to this same gameobject, so we just call the component } } GUILayout.EndArea(); }