Working on networkmanager
This commit is contained in:
43
Assets/Test stuff/TestBallManager.cs
Normal file
43
Assets/Test stuff/TestBallManager.cs
Normal file
@@ -0,0 +1,43 @@
|
||||
|
||||
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}.");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user