readme
This commit is contained in:
9
BITKit/Scripts/Quest/QuestComponent.cs
Normal file
9
BITKit/Scripts/Quest/QuestComponent.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
using Godot;
|
||||
using System;
|
||||
using BITKit;
|
||||
namespace BITKit;
|
||||
public partial class QuestComponent : EntityComponent
|
||||
{
|
||||
[Export] public string QuestName;
|
||||
[Export] public bool QuestCompleted;
|
||||
}
|
28
BITKit/Scripts/Quest/QuestService.cs
Normal file
28
BITKit/Scripts/Quest/QuestService.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using Godot;
|
||||
using System;
|
||||
using System.Text;
|
||||
using BITKit.Core.Entites;
|
||||
namespace BITKit;
|
||||
|
||||
[Tool]
|
||||
public partial class QuestService : Node
|
||||
{
|
||||
private static IEntitiesService entitiesService => DI.Get<IEntitiesService>();
|
||||
|
||||
[Export]
|
||||
[ReadOnly]
|
||||
public string quests;
|
||||
|
||||
public override void _Process(double delta)
|
||||
{
|
||||
if (Engine.IsEditorHint()) return;
|
||||
var stringBuilder= new StringBuilder();
|
||||
foreach (var (quest, condition) in entitiesService.QueryComponents<QuestComponent, ConditionComponent>())
|
||||
{
|
||||
quest.QuestCompleted = condition.OnCheck();
|
||||
//stringBuilder.AppendLine($"{quest.Name}:{quest.QuestCompleted?"已完成":"未完成"}");
|
||||
}
|
||||
|
||||
quests = stringBuilder.ToString();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user