Beispiel #1
0
    void LoadScenario(int currSen)
    {
        // TODO: alter Scenarion based on Stress level (alternate responses, mostly negative)

        currentScenario = currSen;
        XmlNode node1 = scenarioList[currSen];

        if (currSen == 0)
        {
            dragon.resetDragon();
            dragon.stopDragonTimer();
            stressButton.stopStress();
        }
        else
        {
            dragon.startDragonTimer();
            stressButton.startStress();
        }

        foreach (XmlNode items in node1.ChildNodes)
        {
            if (items.Name == "prompt")
            {
                customerPrompt.text = items.InnerText;
            }
            else if (items.Name == "emoLevel")
            {
                emoLevel = int.Parse(items.InnerText);
                setFace();
                Debug.Log("Start emo: " + emoLevel);
            }
            else if (items.Name == "response1")
            {
                csrResponse1.GetComponentInChildren <Text>().text         = items.InnerText;
                csrResponse1.GetComponent <CSRResponseClick>().emoDiff    = int.Parse(items.Attributes["diff"].Value);
                csrResponse1.GetComponent <CSRResponseClick>().nextPrompt = int.Parse(items.Attributes["next"].Value);
            }
            else if (items.Name == "response2")
            {
                csrResponse2.GetComponentInChildren <Text>().text         = items.InnerText;
                csrResponse2.GetComponent <CSRResponseClick>().emoDiff    = int.Parse(items.Attributes["diff"].Value);
                csrResponse2.GetComponent <CSRResponseClick>().nextPrompt = int.Parse(items.Attributes["next"].Value);
            }
            else if (items.Name == "response3")
            {
                csrResponse3.GetComponentInChildren <Text>().text         = items.InnerText;
                csrResponse3.GetComponent <CSRResponseClick>().emoDiff    = int.Parse(items.Attributes["diff"].Value);
                csrResponse3.GetComponent <CSRResponseClick>().nextPrompt = int.Parse(items.Attributes["next"].Value);
            }
            else if (items.Name == "response4")
            {
                csrResponse4.GetComponentInChildren <Text>().text         = items.InnerText;
                csrResponse4.GetComponent <CSRResponseClick>().emoDiff    = int.Parse(items.Attributes["diff"].Value);
                csrResponse4.GetComponent <CSRResponseClick>().nextPrompt = int.Parse(items.Attributes["next"].Value);
            }
        }

        if (currSen == DelayScenario)
        {
            csrResponse1.GetComponent <CSRResponseClick>().nextPrompt = lastScenario;
        }

        //Debug.Log("Current Scenario = " + currentScenario);
    }