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:
2026-05-21 23:37:34 +09:00
commit 4dad9e5d5b
1068 changed files with 175146 additions and 0 deletions
@@ -0,0 +1,47 @@
using UnityEngine;
using UnityEngine.Audio;
using Platinio.TweenEngine;
namespace VRBeats
{
[RequireComponent(typeof(AudioSource))]
public class AudioManager : MonoBehaviour
{
[SerializeField] private AudioMixerGroup mixerGroup = null;
[SerializeField] private float fadeOutTime = 4.0f;
private AudioSource audioSource = null;
private void Start()
{
audioSource = GetComponent<AudioSource>();
audioSource.outputAudioMixerGroup = mixerGroup;
ResetThisComponent();
}
private void ResetThisComponent()
{
SetAudioMixerPitch(1.0f);
gameObject.CancelAllTweens();
}
public BaseTween BlendAudioMixerPitch(float from ,float to)
{
return PlatinioTween.instance.ValueTween(from , to , fadeOutTime).SetEase(Ease.EaseOutExpo).SetOnUpdateFloat(delegate (float v)
{
if(audioSource != null)
SetAudioMixerPitch(v);
}).SetOwner(gameObject);
}
public void SetAudioMixerPitch(float value)
{
audioSource.outputAudioMixerGroup.audioMixer.SetFloat("Pitch", value);
}
}
}
@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: c9f73319c58f4ae4ea6332963855f4b4
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 168243
packageName: VR Beats Kit
packageVersion: 2.0
assetPath: Assets/VRBeatsKit/Scripts/Core/AudioManager.cs
uploadId: 546658
@@ -0,0 +1,27 @@
using DamageSystem;
using UnityEngine;
namespace VRBeats
{
public class BeatDamageInfo : DamageInfo
{
public float velocity;
public ColorSide colorSide;
public GameObject hitObject;
public BeatDamageInfo(DamageInfo damageInfo)
{
dmg = damageInfo.dmg;
hitDir = damageInfo.hitDir;
hitPoint = damageInfo.hitPoint;
explosionRadius = damageInfo.explosionRadius;
upwardsModifier = damageInfo.upwardsModifier;
hitForce = damageInfo.hitForce;
forceMode = damageInfo.forceMode;
damageType = damageInfo.damageType;
canDismember = damageInfo.canDismember;
sender = damageInfo.sender;
}
}
}
@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 2bd68215089d7eb47bd91aeb5c579653
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 168243
packageName: VR Beats Kit
packageVersion: 2.0
assetPath: Assets/VRBeatsKit/Scripts/Core/BeatDamageInfo.cs
uploadId: 546658
@@ -0,0 +1,42 @@
using DamageSystem;
using UnityEngine;
using VRBeats.Events;
namespace VRBeats
{
public class Breakable : Damageable
{
[SerializeField] private float defaultExplosionRadius = 2.0f;
[SerializeField] private float forceModifier = 10.0f;
[SerializeField] private float linealForceModifier = 5.0f;
[SerializeField] private OnDamageEvent onBreak = null;
private Rigidbody[] shatterPieces = null;
private void Awake()
{
shatterPieces = GetComponentsInChildren<Rigidbody>();
}
public void Break(DamageInfo info)
{
for (int n = 0; n < shatterPieces.Length; n++)
{
shatterPieces[n].transform.parent = null;
shatterPieces[n].isKinematic = false;
shatterPieces[n].AddExplosionForce(info.hitForce * forceModifier, info.hitPoint , defaultExplosionRadius);
shatterPieces[n].AddForce(info.hitDir * info.hitForce * linealForceModifier);
}
//Debug.Break();
}
public override void DoDamage(DamageInfo info)
{
Break(info);
onBreak.Invoke(info);
}
}
}
@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 3147d650c94a1b54bb3267725c249623
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 168243
packageName: VR Beats Kit
packageVersion: 2.0
assetPath: Assets/VRBeatsKit/Scripts/Core/Breakable.cs
uploadId: 546658
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: c07f25de0908be14aac5a743359bf22a
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,23 @@
using UnityEngine;
namespace VRBeats
{
[CreateAssetMenu(menuName = "VR Beats/Create Cube Slice Action", fileName = "CubeSliceAction")]
public class BeatCubeSliceAction : OnSliceAction
{
public override bool OnSlice(VR_BeatCube beat, BeatDamageInfo info)
{
if (info.velocity < beat.MinCutSpeed)
return false;
//no matter the hit direction as soon as we have the right velocity for a cube that has a dot
if (beat.HitDirection == Direction.Center)
return true;
float cutAngle = Vector2.Angle(beat.transform.up, info.hitDir);
return info.colorSide == beat.ThisColorSide && cutAngle < 80.0f;
}
}
}
@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 3627bfd50405ca04cbe44b080f9a1edc
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 168243
packageName: VR Beats Kit
packageVersion: 2.0
assetPath: Assets/VRBeatsKit/Scripts/Core/CutActions/BeatCubeSliceAction.cs
uploadId: 546658
@@ -0,0 +1,13 @@
using DamageSystem;
using UnityEngine;
namespace VRBeats
{
public abstract class OnSliceAction : ScriptableObject
{
public abstract bool OnSlice(VR_BeatCube beat, BeatDamageInfo info);
}
}
@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 1a452db34ea67654087ab248a734321a
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 168243
packageName: VR Beats Kit
packageVersion: 2.0
assetPath: Assets/VRBeatsKit/Scripts/Core/CutActions/OnSliceAction.cs
uploadId: 546658
+109
View File
@@ -0,0 +1,109 @@
using DamageSystem;
using VRBeats.Events;
using UnityEngine;
using EzySlice;
namespace VRBeats
{
public class Cuttable : Damageable
{
[SerializeField] private OnDamageEvent onCut = null;
private Material insideMaterial = null;
private const float minCutVelocity = 0.25f;
private void Awake()
{
insideMaterial = GetComponent<MeshRenderer>().material;
}
public override void DoDamage(DamageInfo info)
{
onCut.Invoke(info);
var beatDamageInfo = info as BeatDamageInfo;
if (beatDamageInfo == null) return;
Vector3 cutDir = Vector3.right;
if (beatDamageInfo.velocity > minCutVelocity)
{
cutDir = CalculateCutDirection(info.hitDir, beatDamageInfo.hitObject.transform.up);
}
if (Cut(info.hitPoint, cutDir, insideMaterial))
{
Destroy(gameObject);
}
}
private Vector3 CalculateCutDirection(Vector3 hitDir, Vector3 saberUp)
{
Vector3 cutDir;
if (Mathf.Abs(hitDir.y) > Mathf.Abs(hitDir.x))
{
cutDir = Vector3.right * Mathf.Sign(hitDir.y);
Vector2 saberDir = new Vector2(saberUp.x, saberUp.z);
Vector2 planeDir = new Vector2(0.0f, 1.0f);
saberDir.Normalize();
planeDir.Normalize();
float saberAngle = Vector2.SignedAngle(saberDir, planeDir);
float hitAngle = Vector3.SignedAngle(hitDir, cutDir, Vector3.forward);
cutDir = Quaternion.Euler(0.0f, saberAngle, 90.0f - hitAngle) * cutDir;
}
else
{
Vector2 saberDir = new Vector2(saberUp.x, saberUp.y) * -1;
Vector2 planeDir = new Vector2(0.0f, 1.0f);
saberDir.Normalize();
planeDir.Normalize();
float saberAngle = Vector3.SignedAngle(saberUp, Vector3.forward, Vector3.right); ;
Vector2 hit = new Vector2(hitDir.x, hitDir.y);
Vector2 planeRight = new Vector2(1.0f, 0.0f);
float hitAngle = Vector2.SignedAngle(hit, planeRight);
cutDir = Quaternion.Euler(-saberAngle, 0.0f, -hitAngle) * Vector3.up;
}
return cutDir;
}
private bool Cut(Vector3 point, Vector3 up, Material mat)
{
GameObject[] parts = gameObject.SliceInstantiate(point, up, mat);
if (parts == null)
return false;
for (int n = 0; n < parts.Length; n++)
{
parts[n].AddComponent<DestroyOnBecameInvisible>();
}
Rigidbody rb = parts[0].AddComponent<Rigidbody>();
rb.AddForce(100.0f * up);
rb.AddForce(200.0f * transform.forward * -1);
rb = parts[1].AddComponent<Rigidbody>();
rb.AddForce(100.0f * up * -1.0f);
rb.AddForce(200.0f * transform.forward * -1);
return true;
}
}
}
@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 23ba52288c52c834ca2ffe8729222a32
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 168243
packageName: VR Beats Kit
packageVersion: 2.0
assetPath: Assets/VRBeatsKit/Scripts/Core/Cuttable.cs
uploadId: 546658
@@ -0,0 +1,65 @@
using UnityEngine;
using Platinio.TweenEngine;
namespace VRBeats
{
public class EnviromentController : MonoBehaviour
{
[SerializeField] private MaterialBindings enviromentMaterialBindings = null;
[SerializeField] private float lightsOffTime = 0.5f;
[SerializeField] private float startingEmmisiveValue = 5.0f;
[SerializeField] private Color startingEmmisiveColor = Color.black;
private float currentEmmisiveValue = 0.0f;
private void Awake()
{
currentEmmisiveValue = startingEmmisiveValue;
enviromentMaterialBindings.SetEmmisiveColor(startingEmmisiveColor * startingEmmisiveValue);
}
public void TurnLightsOff()
{
Color from = enviromentMaterialBindings.GetEmmisiveColor();
PlatinioTween.instance.ColorTween(from , Color.black , lightsOffTime).SetOnUpdateColor( delegate (Color c)
{
if(enviromentMaterialBindings != null)
enviromentMaterialBindings.SetEmmisiveColor(c);
} ).SetEase(Ease.EaseOutExpo);
}
public void TurnLightsOn()
{
Color from = enviromentMaterialBindings.GetEmmisiveColor();
PlatinioTween.instance.ColorTween(from, startingEmmisiveColor * startingEmmisiveValue , lightsOffTime).SetOnUpdateColor(delegate (Color c)
{
if (enviromentMaterialBindings != null)
enviromentMaterialBindings.SetEmmisiveColor(c);
}).SetEase(Ease.EaseOutExpo);
}
public void FadeToColor(Color to , float time , Ease ease)
{
Color from = enviromentMaterialBindings.GetEmmisiveColor();
PlatinioTween.instance.ColorTween(from, to * currentEmmisiveValue, time).SetOnUpdateColor(delegate (Color c)
{
if (enviromentMaterialBindings != null)
enviromentMaterialBindings.SetEmmisiveColor(c );
}).SetEase(ease);
}
public void FadeEmmisiveValue(float to, float time, Ease ease)
{
Color color = enviromentMaterialBindings.GetEmmisiveColor();
PlatinioTween.instance.ColorTween(color, color * to, time).SetOnUpdateColor(delegate (Color c)
{
if (enviromentMaterialBindings != null)
enviromentMaterialBindings.SetEmmisiveColor(c);
}).SetEase(ease);
}
}
}
@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 5bbe1429f2ac6b14baf03cf66d349b2d
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 168243
packageName: VR Beats Kit
packageVersion: 2.0
assetPath: Assets/VRBeatsKit/Scripts/Core/EnviromentController.cs
uploadId: 546658
+70
View File
@@ -0,0 +1,70 @@
using DamageSystem;
using UnityEngine;
using VRBeats.ScriptableEvents;
namespace VRBeats
{
public class Mine : MonoBehaviour
{
[SerializeField] private GameEvent onMineSlice = null;
[SerializeField] private GameEvent onGameOver = null;
private float speed = 0.0f;
private Transform player = null;
private bool canBeKilled = true;
private bool destroyed = false;
private void Start()
{
player = VR_BeatManager.instance.Player.transform;
Spawneable spawneable = GetComponent<Spawneable>();
speed = spawneable.Speed;
}
private void OnDestroy()
{
destroyed = true;
}
private void Update()
{
transform.position += Vector3.forward * speed * Time.deltaTime;
if (ShouldKill())
{
Kill();
}
}
public void OnCut( DamageInfo info )
{
onMineSlice.Invoke();
onGameOver.Invoke();
}
private bool ShouldKill()
{
return canBeKilled && transform.position.z < player.position.z - 2.0f;
}
public void Kill()
{
canBeKilled = false;
transform.ScaleTween(Vector3.zero, 2.0f).SetEase(Ease.EaseOutExpo).SetOnComplete(delegate
{
if (!destroyed)
Destroy(gameObject);
});
}
}
}
@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: aff2198efab2bc349a5adccbe226e96d
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 168243
packageName: VR Beats Kit
packageVersion: 2.0
assetPath: Assets/VRBeatsKit/Scripts/Core/Mine.cs
uploadId: 546658
@@ -0,0 +1,32 @@
using UnityEngine;
using UnityEngine.Playables;
public enum Mode
{
Saber,
Boxing
}
namespace VRBeats
{
[CreateAssetMenu(fileName ="TracksDatabase" , menuName = "VR Beats/Create Tracks Database")]
public class TracksDatabase : ScriptableObject
{
[SerializeField] private TrackInfo[] trackList = null;
public TrackInfo[] TrackList { get { return trackList; } }
}
[System.Serializable]
public class TrackInfo
{
public PlayableAsset playableAsset = null;
public Sprite potrait = null;
public Mode Mode = Mode.Saber;
public string songName = null;
public string author = null;
}
}
@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: f6fb941500b9d2145bc1d3a2ffad7f0e
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 168243
packageName: VR Beats Kit
packageVersion: 2.0
assetPath: Assets/VRBeatsKit/Scripts/Core/TracksDatabase.cs
uploadId: 546658
@@ -0,0 +1,114 @@
using DamageSystem;
using UnityEngine;
using VRBeats.ScriptableEvents;
namespace VRBeats
{
public class VR_BeatCube : MonoBehaviour
{
[SerializeField] private float minCutSpeed = 0.5f;
[SerializeField] private OnSliceAction sliceAction = null;
[SerializeField] private GameEvent onCorrectSlice = null;
[SerializeField] private GameEvent onIncorrectSlice = null;
[SerializeField] private GameEvent onPlayerMiss = null;
private MaterialBindings materialBindings = null;
private ColorSide thisColorSide = ColorSide.Right;
private Transform player = null;
private VR_BeatCubeSpawneable thisSpawneable = null;
private bool canBeKilled = true;
private bool spawnComplete = false;
private bool destroyed = false;
public float MinCutSpeed { get { return minCutSpeed; } }
public Direction HitDirection { get { return thisSpawneable.HitDirection; } }
public ColorSide ThisColorSide { get { return thisColorSide; } }
private void Awake()
{
player = VR_BeatManager.instance.Player.transform;
}
public void Start()
{
thisSpawneable = GetComponent<VR_BeatCubeSpawneable>();
thisSpawneable.onSpawnComplete += delegate { spawnComplete = true; };
materialBindings = GetComponent<MaterialBindings>();
thisColorSide = thisSpawneable.ColorSide;
Color color = VR_BeatManager.instance.GetColorFromColorSide(thisColorSide);
materialBindings.SetEmmisiveColor( color );
}
private void OnDestroy()
{
destroyed = true;
}
public void OnCut(DamageInfo info)
{
canBeKilled = false;
//notify to whoever is listening that the player did a correct/incorrect slice
if ( IsCutIntentValid(info as BeatDamageInfo) )
{
onCorrectSlice.Invoke();
}
else
{
onIncorrectSlice.Invoke();
}
}
private bool IsCutIntentValid(BeatDamageInfo info)
{
if (info == null) return false;
if (info.velocity < minCutSpeed) return false;
//no matter the hit direction as soon as we have the right velocity for a cube that has a dot
if (HitDirection == Direction.Center)
return true;
float cutAngle = Vector2.Angle(transform.up, info.hitDir);
return info.colorSide == ThisColorSide && cutAngle < 80.0f;
}
private void Update()
{
if(spawnComplete)
transform.position += Vector3.forward * thisSpawneable.Speed * Time.deltaTime;
if ( ShouldKillCube() )
{
Kill();
}
}
private bool ShouldKillCube()
{
return canBeKilled && transform.position.z < player.position.z - 2.0f;
}
public void Kill()
{
onPlayerMiss.Invoke();
canBeKilled = false;
transform.ScaleTween(Vector3.zero, 2.0f).SetEase(Ease.EaseOutExpo).SetOnComplete( delegate
{
if(!destroyed)
Destroy(gameObject);
} );
}
}
}
@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 67cbc14654dec994dbc2f41cc11342d4
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 168243
packageName: VR Beats Kit
packageVersion: 2.0
assetPath: Assets/VRBeatsKit/Scripts/Core/VR_BeatCube.cs
uploadId: 546658
@@ -0,0 +1,140 @@
using UnityEngine;
using Platinio;
using UnityEngine.Playables;
using VRBeats.ScriptableEvents;
using VRSDK;
namespace VRBeats
{
public class VR_BeatManager : Singleton<VR_BeatManager>
{
[SerializeField] private BoxCollider playZone = null;
[SerializeField] private Transform player = null;
[SerializeField] private VR_BeatSettings settings = null;
[SerializeField] private GameEvent onGameOver = null;
private AudioManager audioManager = null;
private EnviromentController enviromentController = null;
private PlayableDirector playableDirector = null;
private bool isGameRunning = true;
public Color RightColor { get { return settings.RightColor * settings.GlowIntensity; } }
public Color LeftColor { get { return settings.LeftColor * settings.GlowIntensity; } }
public VR_BeatSettings GameSettings { get { return settings; } }
public Transform Player { get { return player; } }
private int playerConsecutiveMiss = 0;
protected override void Awake()
{
base.Awake();
audioManager = FindObjectOfType<AudioManager>();
enviromentController = FindObjectOfType<EnviromentController>();
playableDirector = FindObjectOfType<PlayableDirector>();
}
protected override void Start()
{
base.Start();
playerConsecutiveMiss = 0;
}
public Color GetColorFromColorSide(ColorSide side)
{
return side == ColorSide.Right ? RightColor : LeftColor;
}
public Color GetColorFromControllerType(VR_ControllerType controller)
{
return controller == VR_ControllerType.Right ? RightColor : LeftColor;
}
private int frame = 0;
private void Update()
{
frame++;
}
public void Spawn(Spawneable spawneable , SpawnEventInfo info)
{
if (!isGameRunning)
return;
Vector3 finalPosition = CalculateSpawnPosition( info.position);
Vector3 travelOffset = Vector3.forward * -settings.TargetTravelDistance;
Vector3 spawnPosition = finalPosition - travelOffset;
Spawneable clone = Instantiate( spawneable , spawnPosition , Quaternion.Euler( info.rotation ) );
SetSpeedRelativeToPlayZone(info);
clone.Construct(info);
Vector3 finalScale = clone.transform.localScale;
clone.transform.localScale = Vector3.zero;
clone.transform.Move(finalPosition, settings.TargetTravelTime).SetEase(settings.TargetTravelEase).SetOnComplete(delegate
{
clone.OnSpawn();
}).SetUpdateMode(Platinio.TweenEngine.UpdateMode.Update);
clone.transform.ScaleTween(finalScale, settings.TargetTravelTime).SetEase(settings.TargetTravelEase);
}
private void SetSpeedRelativeToPlayZone(SpawnEventInfo info)
{
info.speedMultiplier = (int) Mathf.Sign(playZone.transform.forward.z * -1.0f);
}
private Vector3 CalculateSpawnPosition(Vector3 relativePosition)
{
Vector3 pos = CalculatePlayZoneCenter();
pos += Vector3.right * relativePosition.x * playZone.size.x;
pos += Vector3.up * relativePosition.y * playZone.size.y;
pos += Vector3.forward * relativePosition.z * playZone.size.z;
return pos;
}
private Vector3 CalculatePlayZoneCenter()
{
return playZone.transform.position + playZone.center;
}
public void GameOver()
{
//the game is already stopped
if (!isGameRunning)
{
return;
}
isGameRunning = false;
//slowdown the music to 0 and stop the playabledirector
audioManager.BlendAudioMixerPitch(1.0f , 0.0f).SetOnComplete( delegate {
if (playableDirector != null)
playableDirector.Stop();
}
).SetOwner(gameObject);
enviromentController.TurnLightsOff();
}
public void RestartLevel()
{
gameObject.CancelAllTweens();
isGameRunning = true;
audioManager.SetAudioMixerPitch(1.0f);
enviromentController.TurnLightsOn();
playableDirector.time = 0.0f;
playableDirector.Play();
}
}
}
@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 239bd2b0c3465a942b8b0b67d10b6925
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 168243
packageName: VR Beats Kit
packageVersion: 2.0
assetPath: Assets/VRBeatsKit/Scripts/Core/VR_BeatManager.cs
uploadId: 546658
@@ -0,0 +1,31 @@
using UnityEngine;
namespace VRBeats
{
[CreateAssetMenu(menuName = "VR Beats/Create Settings" , fileName = "Settings")]
public class VR_BeatSettings : ScriptableObject
{
[Header("Core")]
[SerializeField] private Color rightColor = Color.blue;
[SerializeField] private Color leftColor = Color.red;
[SerializeField] private float glowIntensity = 5.0f;
[SerializeField] private float targetTravelDistance = 10.0f;
[SerializeField] private float targetTravelTime = 0.2f;
[SerializeField] private Ease targetTravelEase = Ease.EaseInOutSine;
[SerializeField] private int errorLimit = 5;
[Header("Score")]
[SerializeField] private int scorePerHit = 50;
[SerializeField] private int maxMultiplier = 8;
public Color RightColor { get { return rightColor; } }
public Color LeftColor { get { return leftColor; } }
public float GlowIntensity { get { return glowIntensity; } }
public float TargetTravelDistance { get { return Mathf.Abs( targetTravelDistance ); } }
public float TargetTravelTime { get { return targetTravelTime; } }
public Ease TargetTravelEase { get { return targetTravelEase; } }
public int ScorePerHit { get { return scorePerHit; } }
public int MaxMultiplier { get { return maxMultiplier; } }
public int ErrorLimit { get { return errorLimit; } }
}
}
@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 7aabf7bc54d695644952b5c737f1c915
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 168243
packageName: VR Beats Kit
packageVersion: 2.0
assetPath: Assets/VRBeatsKit/Scripts/Core/VR_BeatSettings.cs
uploadId: 546658
+28
View File
@@ -0,0 +1,28 @@
using UnityEngine;
using VRSDK;
namespace VRBeats
{
public class VR_Hand : MonoBehaviour
{
[SerializeField] private float emmisionIntensity = 100.0f;
[SerializeField] private MaterialBindings handMaterialBindings = null;
private void Start()
{
TintHand();
}
private void TintHand()
{
VR_ControllerType thisControllerType = GetComponent<VR_Controller>().ControllerType;
Color handColor = VR_BeatManager.instance.GetColorFromControllerType(thisControllerType);
handMaterialBindings.SetUseEmmisiveIntensity(false);
handMaterialBindings.SetEmmisiveColor(handColor * emmisionIntensity);
}
}
}
@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 376d5a2873ae6014cbf5ae3a38a8dfee
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 168243
packageName: VR Beats Kit
packageVersion: 2.0
assetPath: Assets/VRBeatsKit/Scripts/Core/VR_Hand.cs
uploadId: 546658
@@ -0,0 +1,38 @@
using UnityEngine;
namespace VRBeats
{
public class VR_InteractorController : MonoBehaviour
{
private UnityEngine.XR.Interaction.Toolkit.Interactors.XRRayInteractor rayInteractor = null;
private UnityEngine.XR.Interaction.Toolkit.Interactors.Visuals.XRInteractorLineVisual interactorLineVisual = null;
private LineRenderer lineRender = null;
private void Awake()
{
rayInteractor = GetComponent<UnityEngine.XR.Interaction.Toolkit.Interactors.XRRayInteractor>();
interactorLineVisual = GetComponent<UnityEngine.XR.Interaction.Toolkit.Interactors.Visuals.XRInteractorLineVisual>();
lineRender = GetComponent<LineRenderer>();
DisableXRRayInteractorComponents();
}
public void DisableXRRayInteractorComponents()
{
rayInteractor.enabled = false;
interactorLineVisual.enabled = false;
lineRender.enabled = false;
}
public void EnableXRRayInteractorComponents()
{
rayInteractor.enabled = true;
interactorLineVisual.enabled = true;
lineRender.enabled = true;
}
}
}
@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 424884f9ea5654846b7014004769f8aa
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 168243
packageName: VR Beats Kit
packageVersion: 2.0
assetPath: Assets/VRBeatsKit/Scripts/Core/VR_InteractorController.cs
uploadId: 546658
@@ -0,0 +1,75 @@
using UnityEngine;
using VRSDK;
namespace VRBeats
{
public class VR_Saber : MonoBehaviour
{
[SerializeField] private MaterialBindings[] materialBindingArray = null;
[SerializeField] private float emmisionIntensity = 10.0f;
[SerializeField] private Transform body = null;
public Transform Body { get { return body; } }
public ColorSide ColorSide { get { return colorSide; } }
private VR_Grabbable grabbable = null;
private ColorSide colorSide = ColorSide.Left;
private MeshRenderer[] renderArray = null;
private void Awake()
{
renderArray = transform.GetComponentsInChildren<MeshRenderer>();
grabbable = GetComponent<VR_Grabbable>();
grabbable.OnGrabStateChange.AddListener(OnGrabStateChange);
}
private void OnGrabStateChange(GrabState state)
{
if (state == GrabState.Grab)
{
VR_ControllerType controllerType = grabbable.GrabController.ControllerType;
ColorSide colorSide = controllerType == VR_ControllerType.Right ? ColorSide.Right : ColorSide.Left;
Construct(colorSide);
}
}
public void Construct(ColorSide colorSide)
{
this.colorSide = colorSide;
Color c = colorSide == ColorSide.Right ? VR_BeatManager.instance.RightColor : VR_BeatManager.instance.LeftColor;
for (int n = 0; n < materialBindingArray.Length; n++)
{
SetMaterialBindings(materialBindingArray[n], c);
}
}
private void SetMaterialBindings(MaterialBindings matBindings, Color c)
{
matBindings.SetUseEmmisiveIntensity(false);
matBindings.SetEmmisiveColor(c * emmisionIntensity);
}
public void MakeVisible()
{
SetRenderArrayEnableValue(true);
}
public void MakeInvisible()
{
SetRenderArrayEnableValue(false);
}
private void SetRenderArrayEnableValue(bool value)
{
for (int n = 0;n < renderArray.Length; n++)
{
renderArray[n].enabled = value;
}
}
}
}
@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 98fe2bfe056b96c42a1ceb7e616b05f9
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 168243
packageName: VR Beats Kit
packageVersion: 2.0
assetPath: Assets/VRBeatsKit/Scripts/Core/VR_Saber.cs
uploadId: 546658
@@ -0,0 +1,35 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace VRBeats
{
public class VR_SaberContainer : MonoBehaviour
{
private static int selectedSaberIndex = 0;
public static int SelectedSaberIndex { get { return selectedSaberIndex; } }
private void Awake()
{
EnableDesireSaber();
}
public static void SetSelectedSaberIndex(int index)
{
selectedSaberIndex = index;
}
private void EnableDesireSaber()
{
for (int n = 0; n < transform.childCount; n++)
{
transform.GetChild(n).gameObject.SetActive(n == selectedSaberIndex);
}
}
}
}
@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 30abba6566eb65b4a9441f26e6c55eae
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 168243
packageName: VR Beats Kit
packageVersion: 2.0
assetPath: Assets/VRBeatsKit/Scripts/Core/VR_SaberContainer.cs
uploadId: 546658