float ProgressionFraction { get; set; }

robot_2Generated
code_blocksInput

Description

The ProgressionFraction property of the Achievement class represents the current progression of an achievement as a floating-point value. This value ranges from 0 to 1, where 0 indicates 0% completion and 1 indicates 100% completion. The value is not clamped, meaning it can exceed these bounds if the logic of the game allows it.

Usage

Use the ProgressionFraction property to track and display the progress of an achievement to the player. This can be useful for achievements that require incremental progress, such as collecting items or completing tasks over time.

To update the progression, simply set the ProgressionFraction to a new value based on the current state of the achievement. Ensure that the logic for calculating this value is consistent with the achievement's requirements.

Example

// Example of setting the ProgressionFraction for an achievement
Achievement achievement = new Achievement();

// Assuming the achievement requires collecting 100 items
int itemsCollected = 45;
int totalItemsRequired = 100;

// Calculate the progression fraction
achievement.ProgressionFraction = (float)itemsCollected / totalItemsRequired;

// Output the progression percentage
float progressionPercentage = achievement.ProgressionFraction * 100;
// Display to the player
// e.g., UI.DisplayProgression(progressionPercentage);