resources / account_chapter_resource.gd

Attached Scenes

Note
No attached scenes.

Code

extends Resource
class_name AccountChapterResource

@export var number : int = 1
@export var obtained_blue_heart : bool = false
@export var obtained_cassette : bool = false
@export var stages : Array[AccountStageResource]

static func parse_mapping() -> Dictionary:
	return { 'stages': AccountStageResource }


func obtained_strawberry_count() -> int:
	return ArrayHelper.sum(stages, 'obtained_strawberry_count')


func total_failure_count() -> int:
	return ArrayHelper.sum(stages, 'total_failure_count')


func total_play_msec() -> int:
	return ArrayHelper.sum(stages, 'total_play_msec')


func has_stage(value: int) -> bool:
	return stages.any(func(s): return s.number == value)