remify minigame CatsRhythmGame
This commit is contained in:
24
Assets/02_Scripts/Data/Rhythm/RhythmChart.cs
Normal file
24
Assets/02_Scripts/Data/Rhythm/RhythmChart.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user