コード例 #1
0
        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
        }
コード例 #2
0
 public void StartQuest()
 {
     if (quest == null)
     {
         handler.AssignQuest(questName);
         handler.ActivateQuest(questName);
         quest = handler.GetQuest(questName);
         Debug.Log(quest.Status);
     }
 }