Untitled

mail@pastecode.io avatar
unknown
csharp
2 years ago
699 B
0
Indexable
Never
[CreateAssetMenu(menuName = "Create Achievement Library", fileName = "Achievement Library")]
public class AchievementLibrary : ScriptableObject
{
    [SerializeField] private List<AchievementData> achievements = new List<AchievementData>();

    public AchievementData GetAchievement(string achievementID)
    {
        if (achievements.Exists(x => x.achievementID.Equals(achievementID)))
        {
            return achievements.Find(x => x.achievementID.Equals(achievementID));
        }

        return null;
    }

    public void ResetAchievement()
    {
        foreach (AchievementData data in achievements)
        {
            data.collect = false;
        }
    }
}