Jamie Greunbaum 820df6c2bd - Lightning strike animations are now fully working.
- Added an alternate spawn marker, since it was needed for testing anyway.
- Round 1 podium name placard now has baked shading.
- Fixed umbrella model's blend shape normals.
- Removed a lot of unnecessary materials and textures.
- KNOWN ISSUE: Winner camera in round 2 no longer follows winner. Again.
2026-05-13 22:27:55 -04:00

117 lines
2.3 KiB
C#

using MMMaellon.LightSync;
using UdonSharp;
using UnityEngine;
using VRC.SDKBase;
using VRC.Udon.Common;
using VRC.Udon.Common.Interfaces;
[UdonBehaviourSyncMode(BehaviourSyncMode.Manual)]
public class JailPhone : UdonSharpBehaviour
{
[SerializeField] private GameManagerRound2 _GameManager;
[SerializeField] private LightSync _ObjectSync;
[UdonSynced] private bool _Active = false;
[UdonSynced] private bool _CallHasBeenPlayed = false;
private bool _Active_Cached = false;
void Start()
{
_ObjectSync = GetComponent<LightSync>();
}
public override void OnDeserialization(DeserializationResult Result)
{
_Activate_Synced();
base.OnDeserialization(Result);
}
public override void OnPickup()
{
if (Networking.LocalPlayer != _GameManager.GetHostOwner())
{
Networking.SetOwner(Networking.LocalPlayer, gameObject);
}
base.OnPickup();
}
public override void OnPickupUseDown()
{
if (_GameManager.IsRoundInitialised())
{
if (Networking.LocalPlayer == _GameManager.GetHostOwner())
{
PlayJailCall(Networking.LocalPlayer);
}
}
base.OnPickupUseDown();
}
public override void OnOwnershipTransferred(VRCPlayerApi Player)
{
if (_GameManager.IsRoundInitialised())
{
PlayJailCall(Player);
}
base.OnOwnershipTransferred(Player);
}
public void Initialise()
{
Activate(false);
_CallHasBeenPlayed = false;
RequestSerialization();
}
public void Activate(bool Active)
{
if (_GameManager.IsRoundInitialised())
{
_Active = Active;
_Activate_Synced();
_ObjectSync.pickup.pickupable = _Active;
RequestSerialization();
}
}
private void _Activate_Synced()
{
if (_Active != _Active_Cached)
{
if (_Active)
{
_GameManager.PhoneRing();
}
else
{
transform.localPosition = Vector3.zero;
transform.localRotation = Quaternion.identity;
}
}
_Active_Cached = _Active;
}
private void PlayJailCall(VRCPlayerApi Player)
{
if (_Active && !_CallHasBeenPlayed)
{
_GameManager.SendCustomNetworkEvent(NetworkEventTarget.Owner, "FollowPlayerHoldingPhone", Player.displayName);
SendCustomEventDelayedSeconds(nameof(PlayJailCall_Delayed), 0.75f);
_CallHasBeenPlayed = true;
RequestSerialization();
}
}
public void PlayJailCall_Delayed()
{
_GameManager.SendCustomNetworkEvent(NetworkEventTarget.Owner, "PlayJailCall");
}
}