private void Awake() { DontDestroyOnLoad(this.gameObject); handler = GameObject.Find("Quest Handler").GetComponent <QQ_QuestHandler>(); // Assign the quest "Bob Wants Tomatoes" handler.AssignQuest("Bob Wants Tomatoes"); // handler.AssignQuest("Testing"); // Set the quest as active/currently being tracked handler.ActivateQuest("Bob Wants Tomatoes"); //handler.ActivateQuest("Testing"); //handler.DeactivateQuest("Testing"); // Get the quest from the handler quest = handler.GetQuest("Bob Wants Tomatoes"); //quest2 = handler.GetQuest("Testing"); // Set the quest name text to the name of the current quest questName.text = quest.Name; // Set the main task name text to the name of the first task mainTaskName.text = quest.Tasks[0].Name; // Get the main task using its name QQ_Task mainTask = handler.GetTask("Bob Wants Tomatoes", "Get Tomatoes for Bob"); // Set the smaller task 1 name text to the name of the first task int taskID = mainTask.NextTasks[0]; // Get the ID of the next task smallerTask1Name.text = quest.GetTask(taskID).Name; // Display the name // Set the smaller task 2 name text to the name of the first task taskID = mainTask.NextTasks[1]; // Get the ID of the next task smallerTask2Name.text = handler.GetTask("Bob Wants Tomatoes", taskID).Name; // Display the name }
/// <summary> /// Creates a new node of the given type at the given position. /// </summary> /// <param name="type"></param> /// <param name="position"></param> public void CreateNode(QQ_NodeType type, Vector2 position) { int id = NextID++; var node = new QQ_Node(id, type, position.x, position.y); if (type == QQ_NodeType.Quest) { var questNode = new QQ_QuestNode(id, type, position.x, position.y); node.Window.width = questNode.Window.width; node.Window.height = questNode.Window.height; node.Inputs = questNode.CloneKnobs(QQ_KnobType.Input); node.Outputs = questNode.CloneKnobs(QQ_KnobType.Output); node.AllowedInputs = questNode.AllowedInputs; node.AllowedOutputs = questNode.AllowedOutputs; var questData = DataDB.Quest; DataDB.Quest = questData; questNode.Data = questData; QuestNodes.Add(questNode); } else if (type == QQ_NodeType.Task) { var taskNode = new QQ_TaskNode(id, type, position.x, position.y); node.Window.width = taskNode.Window.width; node.Window.height = taskNode.Window.height; node.Inputs = taskNode.CloneKnobs(QQ_KnobType.Input); node.Outputs = taskNode.CloneKnobs(QQ_KnobType.Output); node.AllowedInputs = taskNode.AllowedInputs; node.AllowedOutputs = taskNode.AllowedOutputs; var taskData = new QQ_Task(id); QQ_QuestNode quest = GetQuestNode(0); quest.Data.Tasks.Add(taskData); DataDB.SetQuest(0, quest.Data); taskNode.Data = taskData; TaskNodes.Add(taskNode); } Nodes.Add(node); }