Cleanup goal unlocks behaviour
This commit is contained in:
@@ -23,6 +23,16 @@ extends Resource
|
||||
|
||||
@export var id: StringName = &"" # Unique identifier
|
||||
@export var requirements: Array[GoalRequirementData] # Conditions to complete
|
||||
@export var unlock_behavior: UnlockBehavior = MANUAL # AUTOMATIC or MANUAL
|
||||
```
|
||||
|
||||
### Enum
|
||||
|
||||
```gdscript
|
||||
enum UnlockBehavior {
|
||||
AUTOMATIC, # Goal completes immediately when met
|
||||
MANUAL, # Goal requires player to click unlock button
|
||||
}
|
||||
```
|
||||
|
||||
### Methods
|
||||
@@ -94,9 +104,11 @@ func _on_currency_changed(currency_id, new_amount):
|
||||
|
||||
### Manual Unlock vs Automatic
|
||||
|
||||
Generators can be configured to:
|
||||
- **Automatic**: Unlock immediately when goal completes
|
||||
- **Manual**: Goal completion enables a button player must click
|
||||
Goals control their own unlock behavior via `unlock_behavior`:
|
||||
- **AUTOMATIC**: Goal completes immediately when requirements are met
|
||||
- **MANUAL**: Goal stays incomplete until player clicks unlock button
|
||||
|
||||
Generators with `unlock_goal` automatically unlock when the goal completes.
|
||||
|
||||
## Usage Example
|
||||
|
||||
@@ -130,9 +142,10 @@ amount_exponent = 6 # 1,000,000
|
||||
In `CurrencyGeneratorData`:
|
||||
```gdscript
|
||||
@export var unlock_goal: GoalData # Assign goal resource
|
||||
@export var unlock_goal_behavior: UnlockGoalBehavior = AUTOMATIC
|
||||
```
|
||||
|
||||
The goal's `unlock_behavior` determines if the generator unlocks automatically or requires manual button click.
|
||||
|
||||
## Signals
|
||||
|
||||
```gdscript
|
||||
|
||||
@@ -1,8 +1,14 @@
|
||||
class_name GoalData
|
||||
extends Resource
|
||||
|
||||
enum UnlockBehavior {
|
||||
AUTOMATIC,
|
||||
MANUAL,
|
||||
}
|
||||
|
||||
@export var id: StringName = &""
|
||||
@export var requirements: Array[GoalRequirementData] = []
|
||||
@export var unlock_behavior: UnlockBehavior = UnlockBehavior.MANUAL
|
||||
|
||||
func has_id() -> bool:
|
||||
return not String(id).strip_edges().is_empty()
|
||||
|
||||
Reference in New Issue
Block a user