2026-06-14 커스텀 채보

This commit is contained in:
skrwns304@gmail.com
2026-06-14 16:03:24 +09:00
parent fab54e162e
commit 19c26533f8
3 changed files with 196 additions and 11 deletions

View File

@@ -3,22 +3,28 @@
public class Note
{
[HideInInspector] public float Time;
[HideInInspector] public float Time; // 판정 시각(초)
[HideInInspector] public int Lane; // 레인 인덱스 (단일 레인이면 0)
}
[CreateAssetMenu(fileName = "RhythmChart", menuName = "CatsRoom/RhythmChart")]
public class RhythmChart : ScriptableObject
{
public AudioClip SongClip; // 노래 파일
public float Bpm; // 분당 박자
public float Offset; // 첫 박자 시작 시각
public int NoteCount; // 노트 개수 (또는 곡 길이로 자동)
public List<Note> GenerateNotes() // BPM·offset으로 시간 목록 자동 생성
public AudioClip SongClip; // 노래 파일
public TextAsset MidiFile; // FL Studio에서 내보낸 .mid (확장자를 .bytes로 임포트)
public float Offset; // 곡 시작과 MIDI 0틱 사이 보정(초)
public float BpmOverride; // 0이면 MIDI 내장 템포 사용, >0이면 이 BPM으로 강제
public List<int> LanePitches = new(); // 비우면 모든 노트를 레인 0으로. 채우면 (index=레인) 매핑
// MIDI를 파싱해 노트 시간 목록 생성
public List<Note> GenerateNotes()
{
List<Note> notes = new List<Note>();
float interval = 60f / Bpm;
for (int i = 0; i < NoteCount; i++)
notes.Add(new Note { Time = Offset + interval * i });
return notes;
if (MidiFile == null)
{
Debug.LogWarning($"[RhythmChart] {name}: MidiFile이 비어 있습니다.");
return new List<Note>();
}
return MidiChartParser.Parse(MidiFile.bytes, Offset, BpmOverride, LanePitches);
}
}