关卡一场景上传

This commit is contained in:
xinkl
2025-11-09 09:22:55 +08:00
parent 4f13fe9f07
commit 15515d7393
10 changed files with 766 additions and 73 deletions

View File

@@ -1,4 +1,5 @@
using System.Collections.Generic;
using Unity.Cinemachine;
using UnityEngine;
using UnityEngine.InputSystem;
@@ -28,9 +29,15 @@ public class MusicGame : MonoBehaviour
public void Play()
{
mainCamera.transform.position = new Vector3(0, 100, -10);
mainCamera.transform.rotation = Quaternion.Euler(new Vector3(0, 0, 0));
mainCamera.GetComponent<CinemachineBrain>().enabled = false;
isPlaying = true;
judgeLine = mainCamera.transform.position + new Vector3(0, -2f, 8);
startDsp = AudioSettings.dspTime; // 音频原点
gameObject.GetComponent<AudioSource>().Play();
tickNote.ForEach(x => Destroy(x));
tickNote.Clear();
foreach (MusicTick tick in musicData.musicTicks)
ActivateTick(tick);
}
@@ -87,6 +94,9 @@ public class MusicGame : MonoBehaviour
else
{
isPlaying = false;
tickId = 0;
noteId = 0;
mainCamera.GetComponent<CinemachineBrain>().enabled = true;
Debug.Log("完成所有tick");
}
}

View File

@@ -10,14 +10,14 @@ public class Note : MonoBehaviour
public float approach = 1f;
[Header("运行参数")]
[SerializeField] private float speed = 1f;
[SerializeField] private float speed = 3f;
private bool judged = false;
/* 1. 静态:最近一次空格的 dspTime */
private double lastSpaceTime = double.NegativeInfinity;
private double spawnTime => beatTime - approach;
private float spawnY = 6f;
private float spawnY = MusicGame.Instance.judgeLine.y + 8f;
private float judgeY => MusicGame.Instance.judgeLine.y;
private bool canMove = false;