Files
zeling_v2/Assets/_Game/Scripts/Progression/Achievement/EventTriggeredCondition.cs
2026-05-20 15:10:35 +08:00

23 lines
896 B
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
using UnityEngine;
using BaseGames.Core.Save;
namespace BaseGames.Progression
{
/// <summary>
/// 由事件触发的成就条件(使用 EventChains.WorldFlags 中的布尔标志位)。
/// 由代码如剧情节点、NPC 交互写入标志AchievementManager 轮询检查。
/// </summary>
[CreateAssetMenu(menuName = "BaseGames/Achievement/Condition/EventTriggered", fileName = "COND_EventTriggered_")]
public class EventTriggeredCondition : AchievementCondition
{
[Tooltip("EventChains.WorldFlags 中用于标记此事件发生的布尔 Key")]
public string flagKey;
public override bool IsMet(SaveData save)
{
if (save?.EventChains?.WorldFlags == null || string.IsNullOrEmpty(flagKey)) return false;
return save.EventChains.WorldFlags.TryGetValue(flagKey, out bool val) && val;
}
}
}