Implement setting notes behaviour for ScoreArray.
This commit is contained in:
@@ -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())
|
||||
|
||||
Reference in New Issue
Block a user