float CurrentValue { get; set; }

robot_2Generated
code_blocksInput

Description

The CurrentValue property of the Achievement class represents the current progress value of the achievement. This value is a float and is used to track how much progress has been made towards completing the achievement. It is typically compared against the Range property to determine if the achievement has been unlocked.

Usage

Use the CurrentValue property to get or set the current progress of an achievement. This property is useful for updating the progress as the player completes tasks or objectives related to the achievement.

For example, if an achievement requires the player to collect 100 items, you can increment the CurrentValue each time an item is collected. Once the CurrentValue reaches the upper bound of the Range, the achievement can be marked as unlocked.

Example

// Example of using the CurrentValue property
Achievement achievement = new Achievement();
achievement.Name = "Collector";
achievement.Title = "Item Collector";
achievement.Description = "Collect 100 items.";
achievement.Range = new Vector2(0, 100);

// Simulate collecting an item
achievement.CurrentValue += 1;

// Check if the achievement is unlocked
if (achievement.CurrentValue >= achievement.Range.y)
{
    achievement.IsUnlocked = true;
    Console.WriteLine($"Achievement Unlocked: {achievement.Title}");
}