1
This commit is contained in:
@@ -14,6 +14,7 @@ namespace BITKit.SubSystems.Quest
|
||||
Complete,
|
||||
Canceled,
|
||||
}
|
||||
[Serializable]
|
||||
public class Info
|
||||
{
|
||||
public static implicit operator Guid(Info self)
|
||||
@@ -22,19 +23,18 @@ namespace BITKit.SubSystems.Quest
|
||||
}
|
||||
public static implicit operator string(Info self)
|
||||
{
|
||||
return self.name;
|
||||
return self.Name;
|
||||
}
|
||||
internal Info(string name, string description)
|
||||
{
|
||||
id = Guid.NewGuid();
|
||||
this.name = name;
|
||||
this.description = description;
|
||||
Name = name;
|
||||
Description = description;
|
||||
}
|
||||
public readonly Guid id;
|
||||
public State state { get; internal set; }
|
||||
public string name { get; internal set; }
|
||||
public string description { get; internal set; }
|
||||
//public List<Func<bool>> condition = new();
|
||||
public State State { get; internal set; }
|
||||
public string Name { get; internal set; }
|
||||
public string Description { get; internal set; }
|
||||
}
|
||||
public static Dictionary<Guid, Info> quests { get; private set; } = new();
|
||||
public static event Action<Info> OnQuestCreated;
|
||||
@@ -43,14 +43,14 @@ namespace BITKit.SubSystems.Quest
|
||||
public static Info Create(string name = "New Quest", string description = "Quest in progress")
|
||||
{
|
||||
Info info = new(name, description);
|
||||
info.state = State.InProcess;
|
||||
info.State = State.InProcess;
|
||||
quests.Add(info, info);
|
||||
OnQuestCreated?.Invoke(info);
|
||||
return info;
|
||||
}
|
||||
public static void Complete(Info quest)
|
||||
{
|
||||
quest.state = State.Complete;
|
||||
quest.State = State.Complete;
|
||||
OnQuestCompleted?.Invoke(quest);
|
||||
}
|
||||
public static void Cancel(Info quest)
|
||||
@@ -58,12 +58,12 @@ namespace BITKit.SubSystems.Quest
|
||||
if (quests.ContainsKey(quest.id))
|
||||
{
|
||||
quests.Remove(quest.id);
|
||||
quest.state = State.Canceled;
|
||||
quest.State = State.Canceled;
|
||||
OnQuestCanceled?.Invoke(quest);
|
||||
}
|
||||
}
|
||||
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)]
|
||||
static void Reload()
|
||||
private static void Reload()
|
||||
{
|
||||
quests.Clear();
|
||||
OnQuestCreated = null;
|
||||
|
Reference in New Issue
Block a user