/
Note.ts
38 lines (30 loc) · 879 Bytes
/
Note.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import { EngineArchetypeDataName } from '@sonolus/core'
export class Note extends Archetype {
import = this.defineImport({
beat: { name: EngineArchetypeDataName.Beat, type: Number },
})
targetTime = this.entityMemory(Number)
visualTime = this.entityMemory({
min: Number,
max: Number,
})
globalPreprocess() {
this.life.set({
perfect: 10,
great: 0,
good: 0,
miss: -100,
})
}
preprocess() {
this.targetTime = bpmChanges.at(this.import.beat).time
this.visualTime.max = timeScaleChanges.at(this.targetTime).scaledTime
this.visualTime.min = this.visualTime.max - 120 / bpmChanges.at(this.import.beat).bpm
}
spawnTime() {
return this.visualTime.min
}
despawnTime() {
return this.visualTime.max
}
}