36 lines
1.1 KiB
GDScript
36 lines
1.1 KiB
GDScript
extends ProgressionData
|
|
class_name StoryProgressionData
|
|
|
|
@export var planted_mutation_ids: Array[String] = []
|
|
@export var story_step_i := 0
|
|
@export var mutations_unlocked = 8
|
|
|
|
func get_story_step() -> StoryStep:
|
|
return get_all_story_steps()[story_step_i]
|
|
|
|
func get_story_progression() -> float:
|
|
return max(0,float(story_step_i)) / len(
|
|
get_all_story_steps()
|
|
)
|
|
|
|
func discover_mutation(pm : PlantMutation) -> void:
|
|
planted_mutation_ids.append(pm.id)
|
|
|
|
func get_mutations_discovered() -> Array[String]:
|
|
return planted_mutation_ids
|
|
|
|
func next_story_step() -> void:
|
|
get_story_step()._on_finish()
|
|
if story_step_i + 1 < len(get_all_story_steps()):
|
|
story_step_i += 1
|
|
|
|
func get_available_mutations() -> Array[PlantMutation]:
|
|
return get_all_mutations().slice(0, mutations_unlocked)
|
|
|
|
func are_all_mutations_unlocked() -> bool:
|
|
return mutations_unlocked >= len(get_all_mutations())
|
|
|
|
func unlock_new_mutation() -> PlantMutation:
|
|
var new_mutation = get_all_mutations()[mutations_unlocked]
|
|
mutations_unlocked += 1
|
|
return new_mutation |