-
Notifications
You must be signed in to change notification settings - Fork 0
1. Class Reference
Resource
Pool stat management component.
Component for tracking any numeric stat pool, for example: health, stamina, hunger, etc, where you have current, maximum and minimum values. Handles value modifications, boundary management, and emits various signals for value changes.
| Type | Name | Default |
|---|---|---|
int |
max_value |
100 |
int |
min_value |
0 |
int |
value |
100 |
| Return Type | Method |
|---|---|
void |
decrease(int amount) |
void |
deplete() |
void |
fill() |
float |
get_percentage() const |
void |
increase(int amount) |
bool |
is_depleted() const |
bool |
is_filled() const |
| Signal |
|---|
depleted(StatPool stat) |
max_value_changed(int old_max, int new_max, bool increased) |
min_value_changed(int old_min, int new_min, bool increased) |
restored(StatPool stat) |
restored_fully(StatPool stat) |
value_changed(int old_value, int new_value, bool increased) |
Maximum possible stat value.
If it ever goes below or equal min_value, then min_value will be automatically adjusted to exactly 1 integer below max_value.
Example: If min_value is 0 and you set max_value to 0, then min_value will be adjusted to -1.
Minimum possible stat value.
If it ever goes above or equal max_value, then max_value will be automatically adjusted to exactly 1 integer above min_value.
Example: If max_value is 100 and you set min_value to 100, then max_value will be adjusted to 101.
Current stat value. Automatically clamped between min_value and max_value when set.
Decreases value by the specified amount in amount.
Completely depletes value, setting its value to equal min_value.
Completely fills value, setting its value to equal max_value.
Returns the current value as a percentage (0.0 to 1.0) relative to the range between min_value and max_value.
Increases value by the specified amount in amount.
Returns true if value is at min_value.
Returns true if value is at max_value.
Signal emitted when value reaches min_value.
Signal emitted when max_value changes.
old_max - Represents the previous maximum value before the change.
new_max - Represents the new maximum value after the change.
increased - Indicates whether the maximum value was increased (true) or decreased (false).
Signal emitted when min_value changes.
old_min - Represents the previous minimum value before the change.
new_min - Represents the new minimum value after the change.
increased - Indicates whether the minimum value was increased (true) or decreased (false).
Signal emitted when value changes from min_value to any higher value.
Signal emitted when value reaches its maximum value max_value.
Signal emitted when value changes.
old_value - Represents the previous value before the change.
new_value - Represents the new value after the change.
increased - Indicates whether the value was increased (true) or decreased (false).