using UnityEngine; using BaseGames.Core.Save; namespace BaseGames.Progression { /// 收集指定数量魅饰(Charm)的成就条件。 [CreateAssetMenu(menuName = "Achievement/Condition/CollectedAllCharms", fileName = "COND_CollectedAllCharms")] public class CollectedAllCharmsCondition : AchievementCondition { [Tooltip("需要收集的魅饰总数(游戏设计时确定)")] [Min(1)] public int totalCharmsCount = 45; public override bool IsMet(SaveData save) => save?.Equipment != null && save.Equipment.OwnedCharmIds.Count >= totalCharmsCount; public override float GetProgress(SaveData save) { if (save?.Equipment == null || totalCharmsCount <= 0) return 0f; return UnityEngine.Mathf.Clamp01((float)save.Equipment.OwnedCharmIds.Count / totalCharmsCount); } } }