关卡1流程实现(测试版)
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
using System.Collections.Generic;
|
||||
using A2W;
|
||||
using Unity.Cinemachine;
|
||||
using UnityEngine;
|
||||
using UnityEngine.InputSystem;
|
||||
|
||||
public class MusicGame : MonoBehaviour
|
||||
public class MusicGame : SceneSingleton<MusicGame>
|
||||
{
|
||||
public static MusicGame Instance { get; private set; }
|
||||
public MusicData musicData;
|
||||
private bool isPlaying = false;
|
||||
public Camera mainCamera;
|
||||
@@ -19,12 +19,12 @@ public class MusicGame : MonoBehaviour
|
||||
void Start()
|
||||
{
|
||||
mainCamera = Camera.main;
|
||||
Instance = this;
|
||||
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
if (Keyboard.current.qKey.wasPressedThisFrame) Play();
|
||||
// if (Keyboard.current.qKey.wasPressedThisFrame) Play();
|
||||
}
|
||||
|
||||
public void Play()
|
||||
@@ -98,6 +98,7 @@ public class MusicGame : MonoBehaviour
|
||||
noteId = 0;
|
||||
mainCamera.GetComponent<CinemachineBrain>().enabled = true;
|
||||
Debug.Log("完成所有tick");
|
||||
GameFlowMgr.instance.completeLevel(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -17,8 +17,8 @@ public class Note : MonoBehaviour
|
||||
private double lastSpaceTime = double.NegativeInfinity;
|
||||
|
||||
private double spawnTime => beatTime - approach;
|
||||
private float spawnY = MusicGame.Instance.judgeLine.y + 8f;
|
||||
private float judgeY => MusicGame.Instance.judgeLine.y;
|
||||
private float spawnY = MusicGame.instance.judgeLine.y + 8f;
|
||||
private float judgeY => MusicGame.instance.judgeLine.y;
|
||||
private bool canMove = false;
|
||||
|
||||
void Start() => canMove = false;
|
||||
@@ -56,11 +56,11 @@ public class Note : MonoBehaviour
|
||||
Debug.Log($"音符 {Uid}击中");
|
||||
judged = true;
|
||||
lastSpaceTime = double.NegativeInfinity;
|
||||
MusicGame.Instance.onNoteHit(Uid);
|
||||
MusicGame.instance.onNoteHit(Uid);
|
||||
}
|
||||
else
|
||||
{
|
||||
MusicGame.Instance.onNoteHit(-1);
|
||||
MusicGame.instance.onNoteHit(-1);
|
||||
Debug.Log($"Miss 音符 {Uid}(超时)");
|
||||
|
||||
}
|
||||
|
||||
19
Assets/Gameplay/Scripts/Frist/PianoInteractable.cs
Normal file
19
Assets/Gameplay/Scripts/Frist/PianoInteractable.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class PianoInteractable : MonoBehaviour, IInteractable
|
||||
{
|
||||
public void OnEnterInteractionRange()
|
||||
{
|
||||
Debug.Log("OnEnterInteractionRange");
|
||||
}
|
||||
|
||||
public void OnExitInteractionRange()
|
||||
{
|
||||
Debug.Log("OnExitInteractionRange");
|
||||
}
|
||||
|
||||
public void OnInteract()
|
||||
{
|
||||
MusicGame.instance.Play();
|
||||
}
|
||||
}
|
||||
2
Assets/Gameplay/Scripts/Frist/PianoInteractable.cs.meta
Normal file
2
Assets/Gameplay/Scripts/Frist/PianoInteractable.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e79d148c7efbd67408d55230f5b99a02
|
||||
Reference in New Issue
Block a user