feat: SongCreator 씬 완성 — Beat Sage URL 지원, info.dat 메타데이터 자동 추출
- BeatSageUploader: audio_url 지원(UploadFromUrl), PollAndDownload 공통화, ZIP 500 오류 3회 재시도 - BeatSageConverter: info.dat 파싱(SongMetadata), BPM 자동 감지 → 노트 타이밍 변환에 적용 - SongCreatorManager: title/BPM 필수 입력 제거, 난이도 4개 자동 선택, GenerateFlowFromUrl 버그 수정 - NasPublisher: audioPath null 허용(URL 흐름에서 로컬 파일 없는 경우 스킵) - .gitignore/.gitattributes 초기 설정 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,126 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
using System.Collections;
|
||||
|
||||
namespace VRSDK
|
||||
{
|
||||
|
||||
/// this is just code for handling the demo scene logic, nothing important happens here
|
||||
public class DemoScene : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private EnemySpawner[] enemySpawnerArray = null;
|
||||
[SerializeField] private GameObject spawnPrefab = null;
|
||||
[SerializeField] private Transform spawnPoint = null;
|
||||
[SerializeField] private Animator doorAnimator = null;
|
||||
|
||||
|
||||
private bool doorState = false;
|
||||
private bool canSetTrigger = true;
|
||||
private bool desireDoorState = false;
|
||||
private float currentLeverValue = 0.0f;
|
||||
private bool isSpawningEnemies = false;
|
||||
private VR_ScreenFader gameOverScreenFader = null;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
Player player = FindObjectOfType<Player>();
|
||||
gameOverScreenFader = player.GameOverScreenFader;
|
||||
}
|
||||
|
||||
//called when the black button gets pressed
|
||||
public void OnButtonPressed()
|
||||
{
|
||||
Instantiate(spawnPrefab , spawnPoint.position + Random.insideUnitSphere , spawnPoint.rotation);
|
||||
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
//if we want to spawn enemies and the door is close open it
|
||||
if (isSpawningEnemies && !desireDoorState)
|
||||
{
|
||||
doorAnimator.SetTrigger( "Open" );
|
||||
return;
|
||||
}
|
||||
|
||||
//if the lever is on the open zone
|
||||
if (currentLeverValue >= 0.9f)
|
||||
{
|
||||
if (!doorState && canSetTrigger)
|
||||
{
|
||||
canSetTrigger = false;
|
||||
desireDoorState = true;
|
||||
doorAnimator.SetTrigger( "Open" );
|
||||
}
|
||||
|
||||
}
|
||||
//if the lever is on the closed zone
|
||||
else if (currentLeverValue <= 0.1f)
|
||||
{
|
||||
if (doorState && canSetTrigger)
|
||||
{
|
||||
canSetTrigger = false;
|
||||
desireDoorState = false;
|
||||
doorAnimator.SetTrigger( "Close" );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//called when the lever value change, in other words when you move the lever
|
||||
public void OnLeverValueChange(float v)
|
||||
{
|
||||
currentLeverValue = v;
|
||||
}
|
||||
|
||||
public void SetDoorState( bool state)
|
||||
{
|
||||
doorState = state;
|
||||
canSetTrigger = true;
|
||||
}
|
||||
|
||||
public void EnableEnemySpawning()
|
||||
{
|
||||
if (isSpawningEnemies)
|
||||
return;
|
||||
|
||||
StartCoroutine( EnableEnemySpawningRoutine() );
|
||||
}
|
||||
|
||||
private IEnumerator EnableEnemySpawningRoutine()
|
||||
{
|
||||
isSpawningEnemies = true;
|
||||
|
||||
//the door is open start spawning right now
|
||||
if (doorState)
|
||||
{
|
||||
EnableAllEnemySpawners();
|
||||
}
|
||||
//the door is closed let's wait for it to open
|
||||
else
|
||||
{
|
||||
yield return new WaitForSeconds(5.0f);
|
||||
EnableAllEnemySpawners();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void EnableAllEnemySpawners()
|
||||
{
|
||||
for (int n = 0; n < enemySpawnerArray.Length; n++)
|
||||
{
|
||||
enemySpawnerArray[n].enabled = true;
|
||||
}
|
||||
}
|
||||
|
||||
public void GameOver()
|
||||
{
|
||||
gameOverScreenFader.FadeIn(1.5f , delegate
|
||||
{
|
||||
SceneManager.LoadScene( SceneManager.GetActiveScene().name );
|
||||
} );
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user