// INTERNALS

    private void Initialize(string i_DatabaseResourcePath)
    {
        m_Database = Resources.Load <AchievementsUnlockersDatabase>(i_DatabaseResourcePath);

        if (m_Database != null)
        {
            for (int achievementConditionDescriptorIndex = 0; achievementConditionDescriptorIndex < m_Database.elementsCount; ++achievementConditionDescriptorIndex)
            {
                AchievementUnlockerDescriptor achievementUnlockerDescriptor = m_Database.GetAchievementConditionDescriptor(achievementConditionDescriptorIndex);
                if (achievementUnlockerDescriptor != null)
                {
                    string achievementId = achievementUnlockerDescriptor.achievementId;
                    if (achievementId != "")
                    {
                        AchievementUnlocker achievementUnlocker = new AchievementUnlocker(achievementUnlockerDescriptor);
                        m_AchievementsUnlockers.Add(achievementUnlocker);
                    }
                }
            }
        }
        else
        {
            LogManager.LogWarning(this, "Database could not be loaded.");
        }
    }
Example #2
0
    // CTOR

    public AchievementUnlocker(AchievementUnlockerDescriptor i_Descriptor)
    {
        m_AchievementId = i_Descriptor.achievementId;

        m_CheckOnEvent = i_Descriptor.checkOnEvent;
        m_EventName    = i_Descriptor.eventName;

        m_Conditions = new List <UserStatCondition>();

        for (int conditionDescriptorIndex = 0; conditionDescriptorIndex < i_Descriptor.conditionsCount; ++conditionDescriptorIndex)
        {
            UserStatConditionDescriptor conditionDescriptor = i_Descriptor.GetConditionDescriptor(conditionDescriptorIndex);
            if (conditionDescriptor != null)
            {
                UserStatCondition condition = conditionDescriptor.BuildCondition();
                if (condition != null)
                {
                    m_Conditions.Add(condition);
                }
            }
        }
    }