57 lines
1.6 KiB
C#
57 lines
1.6 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using PixelCrushers.QuestMachine;
|
|
using UnityEngine;
|
|
using UnityEngine.SceneManagement;
|
|
|
|
namespace Beyond
|
|
{
|
|
public class PlayGame : MonoBehaviour
|
|
{
|
|
public LoadSceneMode loadSceneMode = LoadSceneMode.Single;
|
|
|
|
public void LoadScene(string sceneName)
|
|
{
|
|
ProxySceneLoader.LoadScene(sceneName);
|
|
}
|
|
|
|
public void CompleteQuest()
|
|
{
|
|
var journal = QuestMachine.GetQuestJournal();
|
|
Quest currentQuest = null;
|
|
for (int i = 0; i < journal.questList.Count; i++)
|
|
{
|
|
var quest = journal.questList[i];
|
|
|
|
if (!quest.isTrackable || quest.GetState() == QuestState.Successful)
|
|
{
|
|
continue;
|
|
}
|
|
|
|
currentQuest = quest;
|
|
break;
|
|
}
|
|
|
|
|
|
if (currentQuest)
|
|
{
|
|
for (int i = 0; i < currentQuest.nodeList.Count; i++)
|
|
{
|
|
if (currentQuest.nodeList[i].GetState() == QuestNodeState.True)
|
|
{
|
|
continue;
|
|
}
|
|
|
|
if (currentQuest.nodeList[i].GetState() == QuestNodeState.Active)
|
|
{
|
|
currentQuest.nodeList[i].SetState(QuestNodeState.True);
|
|
journal.OnQuestNodeStateChanged(currentQuest.nodeList[i]);
|
|
}
|
|
}
|
|
//journal.();
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|