Beispiel #1
0
    //This will handle what happens when we want next message to appear
    //(Also called by examplePlayer script)
    public void NextNode()
    {
        var data = dialogue.nodeData;

        //Let's not go forward if text is currently being animated, but let's speed it up.
        if (animatingText)
        {
            animatingText = false; return;
        }

        //Check to see if there's extraData and if so, we do stuff
        if (!data.currentIsPlayer && data.extraData != "" && !data.pausedAction)
        {
            bool needsReturn = DoAction(data);
            if (needsReturn)
            {
                UpdateUI();
                return;
            }
        }

        //Let's specifically check for dynamic text change
        if (!data.currentIsPlayer && data.extraData == "itemLookUp" && !data.pausedAction)
        {
            ItemLookUp(data);
        }

        //This will update the dialogue.nodeData with the next Node's data
        dialogue.Next();

        UpdateUI();
    }
Beispiel #2
0
 void Update()
 {
     if (_currentDialogue.isActiveAndEnabled)
     {
         if (!_currentDialogue.nodeData.currentIsPlayer)
         {
             if (Input.GetMouseButtonDown(0) || Input.GetKeyDown(KeyCode.Return))
             {
                 _currentDialogue.Next();
             }
         }
     }
 }
Beispiel #3
0
    //examplePlayer.cs calls this one to move forward in the conversation
    public void CallNext()
    {
        //Let's not go forward if text is currently being animated, but let's speed it up.
        if (animatingText)
        {
            animatingText = false; return;
        }

        if (!dialoguePaused) //Only if
        {
            //We check for current extraData before moving forward to do special actions
            //ExtraDataLookUp returns true if an action requires to skip VIDE_Data.Next()
            //It will be true when we receive an item
            if (ExtraVariablesLookUp(VIDE_Data.nodeData, true))
            {
                return;
            }

            VIDE_Data.Next(); //We call the next node and populate nodeData with new data
            return;
        }

        //This will just disable the item popup if it is enabled
        if (itemPopUp.activeSelf)
        {
            dialoguePaused = false;
            itemPopUp.SetActive(false);
        }
    }
Beispiel #4
0
    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
            }
        }
    }
Beispiel #5
0
    //This will handle what happens when we want next message to appear
    //(Also called by examplePlayer script)
    public void NextNode()
    {
        var data = dialogue.nodeData;

        //Let's not go forward if text is currently being animated, but let's speed it up.
        if (animatingText)
        {
            animatingText = false; return;
        }

        //Check to see if there's extraData and if so, we do stuff
        if (!data.currentIsPlayer && data.extraData != "")
        {
            DoAction(data);
        }
        //Otherwise, let's just move on with the next Player or NPC dialogue
        else
        {
            //This will update the dialogue.nodeData with the next Node's data
            dialogue.Next();
        }

        UpdateUI();
    }
    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();
    }
        public void ChoixEmotion(string put2)
        {
            Debug.Log("Emotion à envoyer =" + put2);

            if (VIDE_Data.isLoaded)
            {
                Debug.Log("Vide data is loaded");
                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
                //   {
                Debug.Log("Current is player");

                if (put2 == "anger ")
                {
                    data.selectedOption = 2;
                    Debug.Log("Emotion change next =" + put2);
                    VIDE_Data.Next();
                }
                if (put2 == "contempt ")
                {
                    data.selectedOption = 0;
                    Debug.Log("Emotion change next =" + put2);
                    VIDE_Data.Next();
                }
                if (put2 == "disgust ")
                {
                    data.selectedOption = 5;
                    Debug.Log("Emotion change next =" + put2);
                    VIDE_Data.Next();
                }
                if (put2 == "fear ")
                {
                    data.selectedOption = 1;
                    Debug.Log("Emotion =" + put2);
                    VIDE_Data.Next();
                }
                if (put2 == "happiness ")
                {
                    data.selectedOption = 0;
                    Debug.Log("Emotion =" + put2);
                    VIDE_Data.Next();
                }
                if (put2 == "neutral ")
                {
                    data.selectedOption = 4;
                    Debug.Log("Emotion change next =" + put2);
                    VIDE_Data.Next();
                }
                if (put2 == "sadness ")
                {
                    data.selectedOption = 3;
                    Debug.Log("Emotion =" + put2);
                    VIDE_Data.Next();
                }
                if (put2 == "surprise ")
                {
                    data.selectedOption = 6;
                    Debug.Log("Emotion =" + put2);
                    VIDE_Data.Next();
                }

                /*  else
                 * {
                 *    data.selectedOption = 4;
                 *    Debug.Log("Emotion Else =" + put2+"test");
                 *    VIDE_Data.Next();
                 *
                 * }
                 */

                //  }
            }
        }
    void Update()
    {
        if (position.x < 1000 && etatMask == 1)
        {
            //   Mask.transform.position = new Vector2(100, 0);

            position.x = position.x + 2;
            this.transform.position = position;
            //  Debug.Log("Postion en X après changement" + position.x);
            //  Debug.Log("Postion en X  et Y après changement" + position);
            Mask.transform.position = position;
        }
        else
        {
            etatMask = 0;
            Debug.Log("Etat mask" + etatMask);
        }

        //   Debug.Log("Postion en X Final" + position.x);
        //  Debug.Log("Postion en X et Y Final " + position);



        if (VIDE_Data.isLoaded) //Only if
        {
            var data = VIDE_Data.nodeData;
            if (data.currentIsPlayer) // If it's a player node, let's show all of the available options as buttons
            {
                Debug.Log("C'est le joueur");
                ordinateur = false;

                if (Timeractive == 0)
                {
                    Photo.TakePhoto();
                    Debug.Log("Photo prise");
                    Timeractive = 3;
                }
            }
            else
            {
                Debug.Log("C'est le comput");
                ordinateur   = true;
                npcText.text = data.npcComment[data.npcCommentIndex];
                if (Timeractive == 0)
                {
                    Timeractive = 1;
                }

                if (Timeractive == 3)
                {
                    coolDownTimer = coolDown;
                    Timeractive   = 1;
                }
            }
            if (data.isEnd) // If it's the end, let's just call EndDialogue
            {
                VIDE_Data.EndDialogue();
                Debug.Log("Chargement de la scène suivante");
                SceneManager.LoadScene("MiroirEmpathique", LoadSceneMode.Single);
            }

            if (Input.GetKey("escape"))
            {
                Application.Quit();
            }
        }


        // CoolDown party


        if (coolDownTimer > 0 && Timeractive == 1)              // Lorsque Le timer est supérieur à 0 et actif
        {
            coolDownTimer -= Time.deltaTime;
            //  Debug.Log("CoolDown" + coolDownTimer);
        }

        if (coolDownTimer < 0 && Timeractive == 1 && ordinateur == true)
        {
            coolDownTimer = coolDown;
            VIDE_Data.Next();
            Debug.Log("Timer finis ordi,Next joueur");
        }

        if (coolDownTimer < 0 && Timeractive == 1 && ordinateur == false)
        {
            Debug.Log("Timer finis du joueur");
            Timeractive = 0;
        }


        if (coolDownTimer > 1.5 && coolDownTimer < 1.9 && Timeractive == 1)
        {
            etatMask = 1;
            Debug.Log("Lancer le mask" + etatMask);
        }
        if (coolDownTimer > 2.5 && Timeractive == 1)
        {
            position = positionIni;
            Debug.Log("Reposition du mask" + position);
        }
        // if (GetComponent<VIDE_Assign>().overrideStartNode == 40)
        if (GetComponent <VIDE_Assign>().overrideStartNode == 9)
        {
            Debug.Log("Chargement de la scène suivante");
            SceneManager.LoadScene("MiroirEmpathique", LoadSceneMode.Single);
        }
    }
Beispiel #9
0
    void Update()
    {
        var data = VIDE_Data.nodeData;

        print(inConversation);

        if (inConversation)
        {
            rbfpc.enabled  = false;
            Cursor.visible = true;
        }
        else
        {
            rbfpc.enabled  = true;
            Cursor.visible = false;
        }

        if (VIDE_Data.isLoaded)
        {
            if (!data.pausedAction)
            {
                if (Input.GetKeyDown(KeyCode.Alpha1))
                {
                    data.selectedOption = 0;
                }
                if (Input.GetKeyDown(KeyCode.Alpha2))
                {
                    data.selectedOption = 1;
                }
                if (Input.GetKeyDown(KeyCode.Alpha3))
                {
                    data.selectedOption = 2;
                }
                if (Input.GetKeyDown(KeyCode.Alpha4))
                {
                    data.selectedOption = 3;
                }
            }

            if (currentOptionsAsGameObjects.Count != 0)
            {
                foreach (GameObject option in currentOptionsAsGameObjects)
                {
                    //Color the Player options. Blue for the selected one
                    for (int i = 0; i < currentOptions.Count; i++)
                    {
                        currentOptions[i].color = Color.white;
                        if (i == data.selectedOption)
                        {
                            currentOptions[i].color = Color.yellow;
                        }
                    }
                }
            }
        }

        //print(data.npcComment[data.npcCommentIndex]);
        //text.text = data.npcComment[data.npcCommentIndex];
        //print(VIDE_Data.nodeData.selectedOption);

        if (Input.GetKeyDown(KeyCode.Mouse0))
        {
            VIDE_Data.Next();
            //aiDialogue.text = string.Empty;
            //playerDialogue.text = string.Empty;
        }
        if (inConversation)
        {
            //text.text = CurrentText();
        }
        if (Input.GetKeyDown(KeyCode.KeypadPlus))
        {
            step++;
        }
    }