fix: widen note lanes and clear warnings
This commit is contained in:
@@ -13,6 +13,11 @@ public class SongController : MonoBehaviour
|
||||
[SerializeField] private GameEvent onLevelComplete;
|
||||
[SerializeField] private TMP_Text countdownText;
|
||||
|
||||
private const float LaneSpacing = 0.42f;
|
||||
private const float LayerSpacing = 0.38f;
|
||||
private const float HorizontalCenter = 1.5f;
|
||||
private const float VerticalCenter = 1f;
|
||||
|
||||
private AudioManager _audio;
|
||||
|
||||
private static string CacheRoot =>
|
||||
@@ -20,7 +25,7 @@ public class SongController : MonoBehaviour
|
||||
|
||||
private void Start()
|
||||
{
|
||||
_audio = FindObjectOfType<AudioManager>();
|
||||
_audio = FindFirstObjectByType<AudioManager>();
|
||||
StartCoroutine(LoadAndPlay());
|
||||
}
|
||||
|
||||
@@ -68,7 +73,7 @@ public class SongController : MonoBehaviour
|
||||
Debug.LogError("[SongController] Map parse failed");
|
||||
yield break;
|
||||
}
|
||||
map.target.Sort((a, b) => a.time.CompareTo(b.time));
|
||||
map.target.Sort(CompareNotes);
|
||||
|
||||
yield return StartCoroutine(Countdown());
|
||||
|
||||
@@ -109,8 +114,8 @@ public class SongController : MonoBehaviour
|
||||
|
||||
private void SpawnNote(NoteData note)
|
||||
{
|
||||
float x = -0.375f + note.position * 0.25f;
|
||||
float y = -0.333f + note.lineLayer * 0.333f;
|
||||
float x = MapLaneX(note.position);
|
||||
float y = MapLayerY(note.lineLayer);
|
||||
|
||||
// 스폰 시점의 실제 남은 시간으로 역산 → 동시 노트가 프레임 차이 나도 같은 타이밍에 도착
|
||||
float remaining = note.time - _audio.CurrentTime;
|
||||
@@ -129,6 +134,31 @@ public class SongController : MonoBehaviour
|
||||
VR_BeatManager.instance.Spawn(cubePrefab, info);
|
||||
}
|
||||
|
||||
private static int CompareNotes(NoteData a, NoteData b)
|
||||
{
|
||||
int timeCompare = a.time.CompareTo(b.time);
|
||||
if (timeCompare != 0)
|
||||
return timeCompare;
|
||||
|
||||
int positionCompare = a.position.CompareTo(b.position);
|
||||
if (positionCompare != 0)
|
||||
return positionCompare;
|
||||
|
||||
return a.lineLayer.CompareTo(b.lineLayer);
|
||||
}
|
||||
|
||||
private static float MapLaneX(int position)
|
||||
{
|
||||
int lane = Mathf.Clamp(position, 0, 3);
|
||||
return (lane - HorizontalCenter) * LaneSpacing;
|
||||
}
|
||||
|
||||
private static float MapLayerY(int lineLayer)
|
||||
{
|
||||
int layer = Mathf.Clamp(lineLayer, 0, 2);
|
||||
return (layer - VerticalCenter) * LayerSpacing;
|
||||
}
|
||||
|
||||
// Beat Saber cutDirection → VRBeats Direction
|
||||
// BS: 0=Up 1=Down 2=Left 3=Right 4=UpperLeft 5=UpperRight 6=LowerLeft 7=LowerRight 8=Any
|
||||
private static readonly Direction[] CutDirMap =
|
||||
|
||||
Reference in New Issue
Block a user