34 lines
721 B
C#
34 lines
721 B
C#
|
|
using CameraSystem;
|
|
using UdonSharp;
|
|
using UnityEngine;
|
|
using VRC.SDKBase;
|
|
using VRC.Udon.Common.Interfaces;
|
|
|
|
|
|
[UdonBehaviourSyncMode(BehaviourSyncMode.Manual)]
|
|
public class CameraSwitchTrigger : UdonSharpBehaviour
|
|
{
|
|
[SerializeField] private CameraControllerBase _CameraController;
|
|
[SerializeField] private string _SwitchFunction;
|
|
|
|
|
|
public override void OnPlayerTriggerEnter(VRCPlayerApi Player)
|
|
{
|
|
if (Networking.GetOwner(_CameraController.gameObject) == Networking.LocalPlayer)
|
|
{
|
|
_CameraController.SendCustomEvent(_SwitchFunction);
|
|
}
|
|
|
|
base.OnPlayerTriggerEnter(Player);
|
|
}
|
|
|
|
|
|
#if UNITY_EDITOR
|
|
private void OnDrawGizmos()
|
|
{
|
|
Gizmos.DrawIcon(transform.position, "CameraSwitcher", true);
|
|
}
|
|
#endif
|
|
}
|