예제 #1
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.S))
        {
            connectManager.SendScript("She digged a hole and planted the tree. Looking at the litte tree, she felt very satisified. \"Oh, I also need water\", thinking of this, she grabbed the watering pot and watered the little tree.");
            List <List <string> > labelsList = new List <List <string> >();
            labelsList = connectManager.ReceiveLabel();

            // set up branch
            storyManager.DoChoice(1);
            storyManager.AddNewBranch("branch two one", 5.0);
            storyManager.DoChoice(0);
            timelineManager.AddTrack(new ActivationTrack(), optionPanel, "activation");
            foreach (List <string> label in labelsList)
            {
                GameObject specialActor = GameObject.Find(label[0]);
                timelineManager.AddVNTrackSet(specialActor);
                for (int i = 1; i < label.Count; i++)
                {
                    timelineManager.Speak(specialActor, TSEiAResourceManager.GetAnimation(label[i]), "Hey there", 0);
                }
            }
            timelineManager.AddCustomClip("activation", 0);
            storyManager.GoTop();
            timelineManager.StartTimeline();
            scriptIndex++;
        }
    }
예제 #2
0
    // what happened if the send button were clicked
    public void OnSendButtonClicked()
    {
        // check the story content
        string content = storyPanel.transform.GetChild(0).GetComponent <TMP_InputField>().text;
        List <List <string> > labelsList = new List <List <string> >();

        if (content.Contains(":"))
        {
            connectManager.SendSpeak(content);
            labelsList = connectManager.ReceiveLabel();

            foreach (List <string> labels in labelsList)
            {
                Debug.Log(labels[0]);
                GameObject subject = GameObject.Find(labels[0]);

                if (subject == null)
                {
                    continue;
                }

                Debug.Log("Track count before Adding:" + timelineManager.IsObjectHasVNTrackSet(subject));

                if (!timelineManager.IsObjectHasVNTrackSet(subject))
                {
                    timelineManager.AddVNTrackSet(subject);
                }

                Debug.Log("Track count after Adding:" + timelineManager.IsObjectHasVNTrackSet(subject));

                System.Random rdm  = new System.Random();
                int           rrrr = rdm.Next(1, 3);
                Debug.Log(rrrr);
                if (rrrr == 1)
                {
                    timelineManager.Speak(GameObject.Find(labels[0]), TSEiAResourceManager.GetAnimation("argue"), labels[1], 0);
                }
                else if (rrrr == 2)
                {
                    timelineManager.Speak(GameObject.Find(labels[0]), TSEiAResourceManager.GetAnimation("talk"), labels[1], 0);
                }

                Debug.Log(timelineManager.GetTimelineAsset().duration);
//                timelineManager.DoAnimationWhileSpeaking(TSEiAResourceManager.GetAnimation("talk"), labels[1], GameObject.Find(labels[0]), 0);
            }
        }
        else
        {
            connectManager.SendScript(content);
            labelsList = connectManager.ReceiveLabel();

            foreach (List <string> labels in labelsList)
            {
                GameObject actor = GameObject.Find(labels[0]);

                if (actor == null)
                {
                    continue;
                }

                Debug.Log("Track count before Adding:" + timelineManager.IsObjectHasVNTrackSet(actor));

                if (!timelineManager.IsObjectHasVNTrackSet(actor))
                {
                    timelineManager.AddVNTrackSet(actor);
                }

                Debug.Log("Track count after Adding:" + timelineManager.IsObjectHasVNTrackSet(actor));
                for (int i = 1; i < labels.Count; i++)
                {
                    timelineManager.AddAnimationClip(TSEiAResourceManager.GetAnimation(labels[i]), actor, 0, false);
                }
            }
        }

        timelineManager.StartTimeline();
        storyPanel.transform.GetChild(0).GetComponent <TMP_InputField>().text = "";
    }