67 lines
1.4 KiB
C#
67 lines
1.4 KiB
C#
|
|
using Marro.PacManUdon;
|
|
using TMPro;
|
|
using UdonSharp;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
using VRC.SDKBase;
|
|
using VRC.Udon;
|
|
|
|
public class TestBallManager : UdonSharpBehaviour
|
|
{
|
|
[SerializeField] TestBall[] testBalls;
|
|
[SerializeField] NetworkManager networkManager;
|
|
[SerializeField] private TMP_InputField debugOutput;
|
|
|
|
void Start()
|
|
{
|
|
networkManager.Initialize();
|
|
foreach (var testBall in testBalls)
|
|
{
|
|
testBall.Initialize(networkManager);
|
|
}
|
|
}
|
|
|
|
public void Update()
|
|
{
|
|
if (debugOutput == null)
|
|
{
|
|
return;
|
|
}
|
|
|
|
debugOutput.text = "";
|
|
networkManager.WriteDebugOutput(debugOutput);
|
|
foreach (var testBall in testBalls)
|
|
{
|
|
testBall.WriteDebugOutput(debugOutput);
|
|
}
|
|
}
|
|
|
|
public void ResetButtonPressed()
|
|
{
|
|
Start();
|
|
}
|
|
|
|
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);
|
|
}
|
|
}
|
|
}
|