25 lines
786 B
C#
25 lines
786 B
C#
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class Note
|
|
{
|
|
public float Time;
|
|
}
|
|
|
|
[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으로 시간 목록 자동 생성
|
|
{
|
|
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;
|
|
}
|
|
}
|