44 lines
1.1 KiB
C#
44 lines
1.1 KiB
C#
|
|
using Marro.PacManUdon;
|
|
using UdonSharp;
|
|
using UnityEngine;
|
|
using VRC.SDKBase;
|
|
using VRC.Udon;
|
|
|
|
public class TestBallManager : UdonSharpBehaviour
|
|
{
|
|
[SerializeField] TestBall[] testBalls;
|
|
[SerializeField] NetworkManager networkManager;
|
|
void Start()
|
|
{
|
|
networkManager.Initialize();
|
|
foreach (var testBall in testBalls)
|
|
{
|
|
testBall.Initialize(networkManager);
|
|
}
|
|
}
|
|
|
|
public void UpButtonPressed()
|
|
{
|
|
foreach (var testBall in testBalls)
|
|
{
|
|
testBall.UpButtonPressed();
|
|
}
|
|
|
|
networkManager.SendEvent((NetworkEventType)1);
|
|
}
|
|
|
|
public void SyncButtonPressed()
|
|
{
|
|
if (VRCPlayerApi.GetPlayerCount() == 1)
|
|
{
|
|
networkManager.SimulateSyncToTimestamp(NetworkManager.TimeToTimestamp(networkManager.SyncedTime - 0.5f));
|
|
}
|
|
else
|
|
{
|
|
networkManager.SendEvent((NetworkEventType)0);
|
|
}
|
|
Debug.Log($"({nameof(TestBall)}) Sync button pressed, synced at progress {GetProgress()} and amountUp {amountUp}.");
|
|
}
|
|
}
|