migration from new repo
This commit is contained in:
commit
423134a840
26930 changed files with 3458568 additions and 0 deletions
39
Assets/_/Features/Quests/Runtime/QuestInitializer.cs
Normal file
39
Assets/_/Features/Quests/Runtime/QuestInitializer.cs
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
using System.Collections.Generic;
|
||||
using Core.Runtime;
|
||||
using Quest.Runtime;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Quests.Runtime._.Features.Quests
|
||||
{
|
||||
public class QuestInitializer : BaseMonobehaviour
|
||||
{
|
||||
void Awake()
|
||||
{
|
||||
var _ = QuestManager.Instance;
|
||||
QuestManager.Instance.QuestDatabase = _questFactoryDatabase;
|
||||
}
|
||||
|
||||
void Start()
|
||||
{
|
||||
if (!FactExists<List<QuestClass>>("active_quests", out var _))
|
||||
{
|
||||
SetFact<List<QuestClass>>("active_quests", new List<QuestClass>(), FactPersistence.Persistent);
|
||||
}
|
||||
QuestManager.Instance.ActiveQuests = GetFact<List<QuestClass>>("active_quests");
|
||||
if (!FactExists<List<QuestClass>>("active_quests", out var _))
|
||||
{
|
||||
SetFact<List<QuestClass>>("completed_quests", new List<QuestClass>(), FactPersistence.Persistent);
|
||||
}
|
||||
QuestManager.Instance.CompletedQuests = GetFact<List<QuestClass>>("completed_quests");
|
||||
Invoke(nameof(NotifyLater), 0.1f);
|
||||
}
|
||||
|
||||
void NotifyLater()
|
||||
{
|
||||
QuestManager.Instance.NotifyCompletedQuests();
|
||||
}
|
||||
|
||||
[SerializeField] QuestFactoryDatabase _questFactoryDatabase;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue