多轮审查和修复
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
using UnityEngine;
|
||||
using BaseGames.Core.Save;
|
||||
|
||||
namespace BaseGames.Progression
|
||||
{
|
||||
/// <summary>收集指定数量魅饰(Charm)的成就条件。</summary>
|
||||
[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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user