Working pretty well

This commit is contained in:
2026-01-03 20:02:17 +01:00
parent a88e4bde81
commit 06c26eb03e
8 changed files with 2353 additions and 1283 deletions

View File

@@ -43,7 +43,7 @@ MonoBehaviour:
Data:
- Name:
Entry: 12
Data: 7
Data: 9
- Name:
Entry: 7
Data:
@@ -434,6 +434,108 @@ MonoBehaviour:
- Name:
Entry: 8
Data:
- Name:
Entry: 7
Data:
- Name: $k
Entry: 1
Data: jumps
- Name: $v
Entry: 7
Data: 25|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: jumps
- Name: <UserType>k__BackingField
Entry: 7
Data: 26|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: System.Single[], mscorlib
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 9
Data: 26
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
- Name:
Entry: 6
Data:
- Name:
Entry: 8
Data:
- Name: <IsSerialized>k__BackingField
Entry: 5
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 27|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 0
- Name:
Entry: 13
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 7
Data:
- Name: $k
Entry: 1
Data: jumpsIndex
- Name: $v
Entry: 7
Data: 28|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: jumpsIndex
- Name: <UserType>k__BackingField
Entry: 9
Data: 11
- Name: <SystemType>k__BackingField
Entry: 9
Data: 11
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
- Name:
Entry: 6
Data:
- Name:
Entry: 8
Data:
- Name: <IsSerialized>k__BackingField
Entry: 5
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 29|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 0
- Name:
Entry: 13
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 13
Data:

View File

@@ -2,7 +2,9 @@
using Marro.PacManUdon;
using System;
using System.Drawing.Text;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
using VRC.SDKBase;
@@ -32,10 +34,15 @@ public class TestBall : SyncedObject
private float amountUp = 0;
private int loopOffset = 0;
private float[] jumps;
private int jumpsIndex;
public void Initialize(NetworkManager networkManager)
{
this.networkManager = networkManager;
sumOfDt = networkManager.SyncedTime;
jumps = new float[10];
jumpsIndex = 0;
}
public override void SyncedUpdate()
@@ -55,6 +62,19 @@ public class TestBall : SyncedObject
amountUp = Mathf.Clamp(amountUp + delta, 0, 1);
}
private void Jump()
{
DeltaUp(UpPerPress);
jumps[jumpsIndex++] = GetProgress();
jumps[jumpsIndex++] = amountUp;
if (jumpsIndex == jumps.Length)
{
jumpsIndex = 0;
}
}
private void SetProgress(float progress)
{
var currentTimestamp = GetCurrentTimestamp();
@@ -101,7 +121,7 @@ public class TestBall : SyncedObject
public void UpButtonPressed()
{
DeltaUp(UpPerPress);
Jump();
Debug.Log($"({nameof(TestBall)}) Up button pressed, jumped up at {GetProgress()} to {amountUp}.");
}
@@ -126,10 +146,26 @@ public class TestBall : SyncedObject
}
else
{
DeltaUp(UpPerPress);
Jump();
Debug.Log($"({nameof(TestBall)}) Received up event, jumped up at {GetProgress()} to {amountUp}.");
}
return true;
}
public void WriteDebugOutput(TMP_InputField debugOutput)
{
string jumpsText = "";
for (int i = 0; i < jumps.Length; i += 2)
{
jumpsText += $"{i/2}. ({jumps[i]}, {jumps[i + 1]}), ";
}
debugOutput.text += $"{nameof(TestBall)} {mode}:\n" +
$"Progress: {GetProgress()}\n" +
$"Up: {amountUp}\n" +
$"SumOfDt: {sumOfDt}\n" +
$"Jumps: {jumpsText}\n" +
$"\n";
}
}

View File

@@ -43,7 +43,7 @@ MonoBehaviour:
Data:
- Name:
Entry: 12
Data: 2
Data: 3
- Name:
Entry: 7
Data:
@@ -176,6 +176,66 @@ MonoBehaviour:
- Name:
Entry: 8
Data:
- Name:
Entry: 7
Data:
- Name: $k
Entry: 1
Data: debugOutput
- Name: $v
Entry: 7
Data: 12|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: debugOutput
- Name: <UserType>k__BackingField
Entry: 7
Data: 13|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: TMPro.TMP_InputField, Unity.TextMeshPro
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 9
Data: 13
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
- Name:
Entry: 6
Data:
- Name:
Entry: 8
Data:
- Name: <IsSerialized>k__BackingField
Entry: 5
Data: true
- Name: _fieldAttributes
Entry: 7
Data: 14|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 1
- Name:
Entry: 7
Data: 15|UnityEngine.SerializeField, UnityEngine.CoreModule
- Name:
Entry: 8
Data:
- Name:
Entry: 13
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 13
Data:

View File

@@ -1,7 +1,9 @@

using Marro.PacManUdon;
using TMPro;
using UdonSharp;
using UnityEngine;
using UnityEngine.UI;
using VRC.SDKBase;
using VRC.Udon;
@@ -9,6 +11,8 @@ public class TestBallManager : UdonSharpBehaviour
{
[SerializeField] TestBall[] testBalls;
[SerializeField] NetworkManager networkManager;
[SerializeField] private TMP_InputField debugOutput;
void Start()
{
networkManager.Initialize();
@@ -18,6 +22,26 @@ public class TestBallManager : UdonSharpBehaviour
}
}
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)