4dad9e5d5b
- 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>
113 lines
3.7 KiB
C#
113 lines
3.7 KiB
C#
using UnityEngine;
|
|
using UnityEngine.Events;
|
|
using VRSDK.Integration;
|
|
|
|
namespace VRSDK
|
|
{
|
|
public class VR_Player : MonoBehaviour
|
|
{
|
|
[SerializeField] private VR_Controller rightController = null;
|
|
[SerializeField] private VR_Controller leftController = null;
|
|
[SerializeField] private VR_CharacterController m_VRCharacterController = null;
|
|
[SerializeField] private Camera m_centerCamera = null;
|
|
[SerializeField] private ControllerGestureConfig gestureConfig = null;
|
|
[SerializeField] private UnityEvent onInitializeComplete = null;
|
|
[SerializeField] private Vector3 m_handGrabGrabRotationOffset = Vector3.zero;
|
|
|
|
private VR_Integration integration = null;
|
|
|
|
public VR_CharacterController VR_CharacterController => m_VRCharacterController;
|
|
public Camera CenterCamera => m_centerCamera;
|
|
|
|
public CharacterController CharacterController
|
|
{
|
|
get
|
|
{
|
|
return FindObjectOfType<CharacterController>();
|
|
}
|
|
}
|
|
|
|
public VR_Controller LeftController
|
|
{
|
|
get
|
|
{
|
|
return GetOrInitializeController(VR_ControllerType.Left);
|
|
}
|
|
}
|
|
|
|
public VR_Controller RightController
|
|
{
|
|
get
|
|
{
|
|
return GetOrInitializeController(VR_ControllerType.Right);
|
|
}
|
|
}
|
|
|
|
public VR_Controller GetActiveController { get { return integration.GetActiveController(); } }
|
|
public Transform TrackingSpace { get { return integration.GeTrackingSpaceTransform(); } }
|
|
public Transform RealLeftHandTransform { get { return integration.GetLeftHandTransform(); } }
|
|
public Transform RealRightHandTransform { get { return integration.GetRightHandTransform(); } }
|
|
|
|
public Vector3 HandGrabRotationOffset => m_handGrabGrabRotationOffset;
|
|
|
|
private VR_Controller GetOrInitializeController(VR_ControllerType controllerType)
|
|
{
|
|
VR_Controller controller = controllerType == VR_ControllerType.Right ? rightController : leftController;
|
|
controller.Construct(gestureConfig);
|
|
return controller;
|
|
}
|
|
|
|
|
|
protected virtual VR_Controller TryGetController(VR_ControllerType controllerType)
|
|
{
|
|
return controllerType == VR_ControllerType.Right ? rightController : leftController;
|
|
}
|
|
|
|
private Transform GetRealHandTransformForController(VR_ControllerType controllerType)
|
|
{
|
|
return controllerType == VR_ControllerType.Right ? RealRightHandTransform : RealLeftHandTransform;
|
|
}
|
|
|
|
public void Construct()
|
|
{
|
|
|
|
if (VR_Manager.instance.CurrentSDK == VR_SDK.Oculus)
|
|
{
|
|
integration = new VR_OculusIntegration();
|
|
}
|
|
|
|
else if (VR_Manager.instance.CurrentSDK == VR_SDK.Steam_VR)
|
|
{
|
|
integration = new VR_SteamVRIntegration();
|
|
}
|
|
else if (VR_Manager.instance.CurrentSDK == VR_SDK.UnityXR)
|
|
{
|
|
integration = new VR_XRIntegration();
|
|
}
|
|
else
|
|
{
|
|
Debug.LogError("[Critical Error] You have set CurrentSDK to None select VR_Manager GameObject in your current scene and please select a valid SDK");
|
|
Debug.Break();
|
|
return;
|
|
}
|
|
|
|
rightController = GetOrInitializeController(VR_ControllerType.Right);
|
|
leftController = GetOrInitializeController(VR_ControllerType.Left);
|
|
|
|
|
|
onInitializeComplete.Invoke();
|
|
}
|
|
|
|
private void Awake()
|
|
{
|
|
//notify a new player
|
|
VR_Manager.instance.SetCurrentPlayer(this);
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|