Implement setting notes behaviour for ScoreArray.

This commit is contained in:
2026-01-29 21:27:08 +08:00
parent aac74427d9
commit 81c8374058

View File

@@ -1,10 +1,21 @@
class_name ScoreArray extends Node
## The note array this score refers to.
## WARNING: Changing the note data clears all scores.
var notes: NoteArray: set = _set_notes
## Set a score for the note at [param index] in [member notes].
## [param offset] is how off the note hit was in seconds.
func set_score(index: int, offset: float) -> void:
_scores.set(index, offset)
# ======== IMPLEMENTATION ======== #
var scores: Array[Note.SCORE]
var _scores: Array[float]
func _set_notes(p_notes: NoteArray) -> void:
if notes == p_notes:
return
notes = p_notes
_scores.clear()
_scores.resize(notes.size())