Beispiel #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++;
        }
    }
Beispiel #2
0
    public void SetBranch()
    {
        timelineManager.AddVNTrackSet(actor);
        timelineManager.AddTrack(new ActivationTrack(), optionPanel, "activation");
        timelineManager.Speak(actor, TSEiAResourceManager.GetAnimation("talk"), "This is the example of branching system", 0);
        timelineManager.Speak(actor, TSEiAResourceManager.GetAnimation("confuse"), "You can create your own story and actions via script", 0);
        timelineManager.Speak(actor, TSEiAResourceManager.GetAnimation("argue"), "Click on those buttons to select branch", 0);
        timelineManager.AddCustomClip("activation", 0);

        storyManager.AddNewBranch("branch one", 5.0);
        storyManager.DoChoice(0);
        timelineManager.AddVNTrackSet(actor);
        timelineManager.AddTrack(new ActivationTrack(), optionPanel, "activation");
        timelineManager.Speak(actor, TSEiAResourceManager.GetAnimation("talk"), "Hey there", 0);
        timelineManager.Speak(actor, TSEiAResourceManager.GetAnimation("confuse"), "You just chose the first branch", 0);
        timelineManager.Speak(actor, TSEiAResourceManager.GetAnimation("argue"), "You can also customize the option panel by yourself", 0);
        timelineManager.Speak(actor, TSEiAResourceManager.GetAnimation("talk"), "For example, you can set button for going backward to upper branch.", 0);
        timelineManager.AddCustomClip("activation", 0);
        storyManager.GoBackLevel();

        storyManager.AddNewBranch("branch two", 5.0);
        storyManager.DoChoice(1);
        timelineManager.AddVNTrackSet(actor);
        timelineManager.AddTrack(new ActivationTrack(), optionPanel, "activation");
        timelineManager.Speak(actor, TSEiAResourceManager.GetAnimation("talk"), "Hey there", 0);
        timelineManager.Speak(actor, TSEiAResourceManager.GetAnimation("confuse"), "You just chose the second branch", 0);
        timelineManager.Speak(actor, TSEiAResourceManager.GetAnimation("argue"), "You can also customize the option panel by yourself", 0);
        timelineManager.Speak(actor, TSEiAResourceManager.GetAnimation("talk"), "For example, you can set button for going backward to upper branch.", 0);
        timelineManager.AddCustomClip("activation", 0);
        storyManager.GoBackLevel();

        timelineManager.StartTimeline();
    }
Beispiel #3
0
    // Use this for initialization
    void Start()
    {
        scriptList.Add("She sneaked to the room and stole the item from the shelf.");
        scriptList.Add("She sneaked towards him and killed him from back.");
        scriptList.Add("She stood there for a while, waving hand to me and finally turned around and ran away.");
        scriptList.Add("She waved hand to him so that he could notice her. She walked to him and shook hand with him.");
        scriptList.Add("After hearing that she won the prize, she danced happily.");
        scriptList.Add("She dose exercise everyday in order to keep her body in good shape.");
        scriptList.Add("She really loves those days on the farm. Everyday she picks up the fruit and water the veggies.");
        scriptList.Add("She grabbed the torch from the ground telling herself that everything will be fine. Then she encouraged herself and went deeper to search for the item she needed to cure her mother.");
        scriptList.Add("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.");
        scriptList.Add("Losing her job, she felt so disappointed at the herself. She was so helpless. She stopped when she passed the store. Looking into the shelf, she could see the necklece is still there, but not shining anymore.");
        scriptList.Add("That day she had an arguement with him. She found he didn't care anything about her. He left and she cried, again.");
        scriptList.Add("She successfully sneaked into the basement. It was so dark that she couldn't see anything. She lit the torch and tried to go deeper inside.");
        scriptList.Add("Calming down, she could be one hundred percent focus. Setting up, aiming, drive and she made it. And she didn't forget to laugh at her oppnents in the end.");
        // register resource database to the word embedding server
        TSEiAResourceManager.LoadAnimation();

        /*
         * Debug.Log(TSEiAResourceManager.GetAnimation("drunkwalk"));
         *
         * timelineManager.AddTrack(new AnimationTrack(), actor);
         * timelineManager.AddAnimationClip(TSEiAResourceManager.GetAnimation("drunkwalk"), actor, 0, false);
         * timelineManager.AddAnimationClip(TSEiAResourceManager.GetAnimation("holdwalk"), actor, -0.1, false);
         *
         * timelineManager.AddTrack(new CinemachineTrack(), camera, "CameraTrack");
         * CinemachineShot cinemaClip = timelineManager.AddCustomClip("CameraTrack", 0) as CinemachineShot;
         */
        SetBranch();
    }
Beispiel #4
0
    // Use this for initialization
    void Start()
    {
        timelineManager.AddVNTrackSet(actor);
        //        timelineManager.AddAnimationClip(TSEiAResourceManager.GetAnimation("argue"), actor);

        timelineManager.AddTrack(new ActivationTrack(), optionPanel, "activation");

        timelineManager.Speak(actor, TSEiAResourceManager.GetAnimation("argue"), "Hello", -0.5);
        timelineManager.Speak(actor, TSEiAResourceManager.GetAnimation("talk"), "blabalblablabl", -0.5);
        timelineManager.Speak(actor, TSEiAResourceManager.GetAnimation("talk"), "this is the first branch", -0.5);
        timelineManager.Speak(actor, TSEiAResourceManager.GetAnimation("argue"), "I don't know ", -0.5);

        timelineManager.AddCustomClip("activation", 0);

        storyManager.AddNewBranch("new branch one", 5.0);
        storyManager.DoChoice(0);
        timelineManager.AddVNTrackSet(actor);
        timelineManager.AddTrack(new ActivationTrack(), optionPanel, "activation");

        timelineManager.Speak(actor, TSEiAResourceManager.GetAnimation("argue"), "Hello", -0.5);
        timelineManager.Speak(actor, TSEiAResourceManager.GetAnimation("talk"), "this is the first sub-branch of the original branch", -0.5);
        timelineManager.Speak(actor, TSEiAResourceManager.GetAnimation("talk"), "because you just cliked on the first button", -0.5);
        timelineManager.AddCustomClip("activation", 0);
        storyManager.GoBackLevel();

        storyManager.AddNewBranch("new branch two", 5.0);
        storyManager.DoChoice(1);
        timelineManager.AddVNTrackSet(actor);
        timelineManager.AddTrack(new ActivationTrack(), optionPanel, "activation");

        timelineManager.Speak(actor, TSEiAResourceManager.GetAnimation("argue"), "Hello", -0.5);
        timelineManager.Speak(actor, TSEiAResourceManager.GetAnimation("talk"), "this is the second sub-branch of the original branch", -0.5);
        timelineManager.Speak(actor, TSEiAResourceManager.GetAnimation("talk"), "because you just cliked on the second button", -0.5);
        timelineManager.AddCustomClip("activation", 0);
        storyManager.GoBackLevel();

        storyManager.AddNewBranch("new branch three", 5.0);
        storyManager.DoChoice(2);
        timelineManager.AddVNTrackSet(actor);
        timelineManager.AddTrack(new ActivationTrack(), optionPanel, "activation");

        timelineManager.Speak(actor, TSEiAResourceManager.GetAnimation("argue"), "Hello", -0.5);
        timelineManager.Speak(actor, TSEiAResourceManager.GetAnimation("talk"), "this is the third sub-branch of the original branch", -0.5);
        timelineManager.Speak(actor, TSEiAResourceManager.GetAnimation("talk"), "because you just cliked on the third button", -0.5);
        timelineManager.AddCustomClip("activation", 0);

        storyManager.AddNewBranch("new branch one - one", 5.0);
        storyManager.DoChoice(0);
        timelineManager.AddVNTrackSet(actor);
        timelineManager.AddTrack(new ActivationTrack(), optionPanel, "activation");

        timelineManager.Speak(actor, TSEiAResourceManager.GetAnimation("argue"), "Hello", -0.5);
        timelineManager.Speak(actor, TSEiAResourceManager.GetAnimation("talk"), "this is the first sub-branch of the new branch three", -0.5);
        timelineManager.Speak(actor, TSEiAResourceManager.GetAnimation("talk"), "because you just cliked on the first button", -0.5);
        timelineManager.AddCustomClip("activation", 0);
        storyManager.GoBackLevel();
        storyManager.GoBackLevel();

        timelineManager.StartTimeline();
    }
Beispiel #5
0
    // Use this for initialization
    void Start()
    {
        storyCreator = GameObject.Find("StoryCreator").GetComponent <StoryCreator>();

        animationList  = TSEiAResourceManager.LoadAnimation();
        operationPanel = gameObject.transform.GetChild(0);
        for (int i = 0; i < operationPanel.childCount - 2; i++)
        {
            operationPanel.GetChild(i).gameObject.GetComponent <Dropdown>().AddOptions(animationList);
        }
    }
Beispiel #6
0
    // triggered when the generated button is clicked
    public void OnGenerateClicked()
    {
        storyCreator.storyManager.CreateNewBranch("new", 0.0);
        storyCreator.storyManager.DoChoice(0);
        storyCreator.timelineManager.AddTrack(new AnimationTrack(), storyCreator.actor);
        CinemachineTrack cameraTrack = storyCreator.timelineManager.AddTrack(new CinemachineTrack(), "Camera") as CinemachineTrack;
        CinemachineShot  cameraClip  = storyCreator.timelineManager.AddCustomClipWithInitialTime(cameraTrack, 0) as CinemachineShot;


        storyCreator.ResetActioPosition();
        for (int i = 0; i < operationPanel.childCount - 2; i++)
        {
            int option = operationPanel.GetChild(i).GetComponent <Dropdown>().value;
            if (animationList[option] != "None")
            {
                storyCreator.timelineManager.AddAnimationClip(TSEiAResourceManager.GetAnimation(animationList[option]),
                                                              storyCreator.actor, -0.1, false);
            }
        }
        storyCreator.timelineManager.StartTimeline();
    }
    // 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 = "";
    }
 // Use this for initialization
 void Start()
 {
     TSEiAResourceManager.LoadAnimation();
 }