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,69 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.AI;
|
||||
|
||||
|
||||
namespace VRSDK
|
||||
{
|
||||
public class EnemySpawner : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private GameObject[] enemies = null;
|
||||
[SerializeField] private float spawnTime = 5.0f;
|
||||
[SerializeField] private float spawnRadius = 1.0f;
|
||||
[SerializeField] private int maxEnemies = 10;
|
||||
|
||||
|
||||
private float timer = 0.0f;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
timer = Random.Range(spawnTime / 2.0f , spawnTime);
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
timer -= Time.deltaTime;
|
||||
|
||||
if(timer <= 0.0f)
|
||||
Spawn();
|
||||
}
|
||||
|
||||
//creates a new enemy
|
||||
private void Spawn()
|
||||
{
|
||||
timer = Random.Range(spawnTime / 2.0f, spawnTime);
|
||||
|
||||
//check if dont have to many enemies already
|
||||
if (GameObject.FindGameObjectsWithTag( "Enemy" ).Length > maxEnemies)
|
||||
return;
|
||||
|
||||
GameObject enemy = enemies[Random.Range(0 , enemies.Length)];
|
||||
|
||||
if (RandomNavmeshLocation(spawnRadius, out Vector3 spawnPoint))
|
||||
{
|
||||
Instantiate(enemy, spawnPoint, transform.rotation);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//return a random point inside the navmesh radius
|
||||
private bool RandomNavmeshLocation(float radius, out Vector3 spawnPosition)
|
||||
{
|
||||
Vector3 randomDirection = Random.insideUnitSphere * radius;
|
||||
randomDirection += transform.position;
|
||||
NavMeshHit hit;
|
||||
spawnPosition = Vector3.zero;
|
||||
|
||||
if (NavMesh.SamplePosition(randomDirection, out hit, radius, 1))
|
||||
{
|
||||
spawnPosition = hit.position;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user