CarmenSandiego/Assets/UdonSharp/PlayerTeleporter.cs
Jamie Greunbaum cfd9defc1f - Audience silencer implemented, and only enabled for first two rounds.
- Host teleport button enables on case load/respawn, and disables on teleport.
- Videos no longer infinitely retry loading.
- Improved lightmapping quality.
- Removed kernelsCache folder from index.
2025-09-05 17:57:45 -04:00

66 lines
1.7 KiB
C#

using UdonSharp;
using UnityEngine;
using UnityEngine.UI;
using VRC.SDKBase;
[UdonBehaviourSyncMode(BehaviourSyncMode.Manual)]
public class PlayerTeleporter : UdonSharpBehaviour
{
[SerializeField] private Transform _HostTeleportLocation;
[SerializeField] private Transform _Player1TeleportLocation;
[SerializeField] private Transform _Player2TeleportLocation;
[SerializeField] private Transform _Player3TeleportLocation;
[SerializeField] private Transform _AudienceTeleportLocation;
[Space]
[SerializeField] private Button _HostTeleportButton;
[Space]
[SerializeField] private PlayerPodium[] _PlayerPodiums;
public override void OnPlayerRespawn(VRCPlayerApi Player)
{
if (Player == Networking.InstanceOwner || Player == Networking.Master)
{
_HostTeleportButton.gameObject.SetActive(true);
}
base.OnPlayerRespawn(Player);
}
public void TeleportToHostPosition()
{
_HostTeleportButton.gameObject.SetActive(false);
Networking.LocalPlayer.TeleportTo(_HostTeleportLocation.position, _HostTeleportLocation.rotation);
}
public void TeleportToPlayer1Position()
{
_PlayerPodiums[0].SetPlayerName();
Networking.LocalPlayer.TeleportTo(_Player1TeleportLocation.position, _Player1TeleportLocation.rotation);
}
public void TeleportToPlayer2Position()
{
_PlayerPodiums[1].SetPlayerName();
Networking.LocalPlayer.TeleportTo(_Player2TeleportLocation.position, _Player2TeleportLocation.rotation);
}
public void TeleportToPlayer3Position()
{
_PlayerPodiums[2].SetPlayerName();
Networking.LocalPlayer.TeleportTo(_Player3TeleportLocation.position, _Player3TeleportLocation.rotation);
}
public void TeleportToAudience()
{
Networking.LocalPlayer.TeleportTo(_AudienceTeleportLocation.position, _AudienceTeleportLocation.rotation);
}
}