public void TaskDone(TaskNode task)
    {
        Debug.Log ("Task: " + task.data.Type + " done.");
        task.done = true;
        //Get the gui script and task.
        WorldGUI wgui = Globals.Instance.WorldGUI;

        //Set the dialogue and flag the GUI to display it.
        wgui.Dialogues.Add (task.data.PostDialogue);
        wgui.DisplayDialogue = true;
        PostDialogueStarted = true;
    }
示例#2
0
        /// <summary>
        /// Checks to see if there is a mismatch between the required mood for an ending and the current villain mood
        /// </summary>
        /// <returns>
        /// Whether there is mood mismatch or not
        /// </returns>
        /// <param name='node'>
        /// Current TaskNode to test this expression on
        /// </param>
        private static bool moodMismatch(TaskNode node)
        {
            GameObject villain = GameObject.FindGameObjectWithTag ("Villain");
            EmotionModel emotionModel = villain.GetComponent<EmotionModel> ();

            if (node.data.IsEnding && emotionModel.CurrentMoods.CurrentMood.CurrentMood.ToString () != node.data.Mood.ToUpper ()) {
                return true;
            }

            return false;
        }
示例#3
0
        private void buildTaskGraph(List<StoryEvent> events, List<Link> links)
        {
            Dictionary<int, TaskNode> dictionary = new Dictionary<int, TaskNode> ();
            foreach (StoryEvent e in events) {
                int id = e.ID;
                Task t = new Task (e);
                Debug.Log ("built task " + id+","+t.IsEnding+","+t.Mood+","+t.Type);
                TaskNode node = new TaskNode (t);
                dictionary.Add (id, node);
            }

            foreach (Link l in links) {
                TaskNode parentNode = dictionary [l.Source];
                TaskNode childNode = dictionary [l.Target];
                if (!parentNode.children.Contains (childNode))
                    parentNode.children.Add (childNode);
                if (!childNode.parents.Contains (parentNode))
                    childNode.parents.Add (parentNode);
            }

            List<TaskNode> roots = new List<TaskNode> ();
            foreach (KeyValuePair<int, TaskNode> pair in dictionary) {
                if (pair.Value.parents.Count == 0)
                    roots.Add (pair.Value);
            }
            // TODO: throw an exception when there are more than one root
            this.scriptRoot = roots.ElementAt (0);

            this.endings = new List<TaskNode> ();
            foreach (KeyValuePair<int, TaskNode> pair in dictionary) {
                if (pair.Value.children.Count == 0)
                    endings.Add (pair.Value);
            }
        }
    public void TaskDone(TaskNode task)
    {
        GameObject em = GameObject.Find ("Emotion Manager");
        em.GetComponent<EmotionManager>().UpdateEmotionalModel();
        Debug.Log ("Task: " + task.data.Type + " done.");
        task.done = true;
        //Get the gui script and task.
        WorldGUI wgui = Globals.Instance.WorldGUI;

        //Set the dialogue and flag the GUI to display it.
        wgui.Dialogues.Add (task.data.PostDialogue);
        wgui.DisplayDialogue = true;
        PostDialogueStarted = true;
    }