- Round 1 window shatter effect now plays at more random pitches. - Added a proper camera switcher for the Chase intro, and adjusted timing. - Added the basic ability for a camera to follow multiple players.
64 lines
943 B
C#
64 lines
943 B
C#
|
|
using UdonSharp;
|
|
using UnityEngine;
|
|
using VRC.Udon.Common.Interfaces;
|
|
|
|
|
|
[UdonBehaviourSyncMode(BehaviourSyncMode.Manual)]
|
|
public class GlassShatter : UdonSharpBehaviour
|
|
{
|
|
[SerializeField] AudioManager _AudioManager;
|
|
|
|
[UdonSynced, FieldChangeCallback(nameof(Shattered))] private bool _Shattered = false;
|
|
|
|
private bool _Prepared = false;
|
|
|
|
|
|
public void PrepareEnter()
|
|
{
|
|
if (!Shattered)
|
|
{
|
|
_Prepared = true;
|
|
}
|
|
}
|
|
public void PrepareExit()
|
|
{
|
|
_Prepared = false;
|
|
}
|
|
|
|
public void ShatterEnter()
|
|
{
|
|
if (_Prepared && !Shattered)
|
|
{
|
|
Shattered = true;
|
|
_Shatter_Synced();
|
|
RequestSerialization();
|
|
}
|
|
}
|
|
|
|
public void ShatterExit()
|
|
{
|
|
Shattered = false;
|
|
}
|
|
|
|
|
|
private void _Shatter_Synced()
|
|
{
|
|
if (Shattered)
|
|
{
|
|
_AudioManager.PlaySFXAtPitch(SFXEventType.GlassShatter, Random.Range(0.9f, 1.1f));
|
|
}
|
|
}
|
|
|
|
|
|
public bool Shattered
|
|
{
|
|
set
|
|
{
|
|
_Shattered = value;
|
|
_Shatter_Synced();
|
|
}
|
|
get => _Shattered;
|
|
}
|
|
}
|