Compare commits

..

1 Commits

Author SHA1 Message Date
4ef936bf16 PrepareForCutscene 2025-12-26 18:27:04 +01:00
72 changed files with 4871 additions and 14009 deletions

View File

@@ -1,6 +0,0 @@
{
"version": "1.0",
"components": [
"Microsoft.VisualStudio.Workload.ManagedGame"
]
}

View File

@@ -5,7 +5,7 @@ TextureImporter:
externalObjects: {} externalObjects: {}
serializedVersion: 12 serializedVersion: 12
mipmaps: mipmaps:
mipMapMode: 1 mipMapMode: 0
enableMipMap: 1 enableMipMap: 1
sRGBTexture: 1 sRGBTexture: 1
linearTexture: 0 linearTexture: 0

View File

@@ -5,7 +5,7 @@ TextureImporter:
externalObjects: {} externalObjects: {}
serializedVersion: 12 serializedVersion: 12
mipmaps: mipmaps:
mipMapMode: 1 mipMapMode: 0
enableMipMap: 1 enableMipMap: 1
sRGBTexture: 1 sRGBTexture: 1
linearTexture: 0 linearTexture: 0

View File

@@ -5,7 +5,7 @@ TextureImporter:
externalObjects: {} externalObjects: {}
serializedVersion: 12 serializedVersion: 12
mipmaps: mipmaps:
mipMapMode: 1 mipMapMode: 0
enableMipMap: 1 enableMipMap: 1
sRGBTexture: 0 sRGBTexture: 0
linearTexture: 0 linearTexture: 0

View File

@@ -5,7 +5,7 @@ TextureImporter:
externalObjects: {} externalObjects: {}
serializedVersion: 12 serializedVersion: 12
mipmaps: mipmaps:
mipMapMode: 1 mipMapMode: 0
enableMipMap: 1 enableMipMap: 1
sRGBTexture: 1 sRGBTexture: 1
linearTexture: 0 linearTexture: 0

View File

@@ -5,7 +5,7 @@ TextureImporter:
externalObjects: {} externalObjects: {}
serializedVersion: 12 serializedVersion: 12
mipmaps: mipmaps:
mipMapMode: 1 mipMapMode: 0
enableMipMap: 1 enableMipMap: 1
sRGBTexture: 1 sRGBTexture: 1
linearTexture: 0 linearTexture: 0

File diff suppressed because it is too large Load Diff

View File

@@ -1,15 +1,14 @@
using UdonSharp; namespace Marro.PacManUdon
using UnityEngine;
using VRC.SDK3.Data;
namespace Marro.PacManUdon
{ {
[RequireComponent(typeof(Animator))] using UdonSharp;
[RequireComponent(typeof(Renderer))] using UnityEngine;
[RequireComponent(typeof(Collider))] using VRC.SDK3.Data;
public class BonusFruit : SyncedObject using VRC.SDKBase;
using VRC.Udon;
public class BonusFruit : UdonSharpBehaviour
{ {
PacManFruitType fruitType; [SerializeField, UdonSynced, FieldChangeCallback(nameof(FruitType))] PacManFruitType fruitType;
Animator animator; Animator animator;
new Renderer renderer; new Renderer renderer;
@@ -31,11 +30,11 @@ namespace Marro.PacManUdon
SetActive(false); SetActive(false);
} }
public override void SyncedUpdate() void Update()
{ {
if (active && !frozen) if (active && !frozen)
{ {
activeCountdown -= networkManager.SyncedDeltaTime; activeCountdown -= Time.deltaTime;
if (activeCountdown <= 0) if (activeCountdown <= 0)
{ {
SetActive(false); SetActive(false);
@@ -68,6 +67,7 @@ namespace Marro.PacManUdon
this.fruitType = fruitType; this.fruitType = fruitType;
value = (int)fruitScoreValue[PacManConstants.FruitTypeToValue(fruitType)]; value = (int)fruitScoreValue[PacManConstants.FruitTypeToValue(fruitType)];
animator.SetFloat("FruitType", PacManConstants.FruitTypeToValue(fruitType)); animator.SetFloat("FruitType", PacManConstants.FruitTypeToValue(fruitType));
RequestSerialization();
} }
public void SetFrozen(bool frozen) public void SetFrozen(bool frozen)
@@ -80,16 +80,7 @@ namespace Marro.PacManUdon
renderer.enabled = active; renderer.enabled = active;
collider.enabled = active; collider.enabled = active;
this.active = active; this.active = active;
} RequestSerialization();
public override void CollectSyncedData(byte[] data, ref int index, NetworkEventType eventType)
{
}
public override bool WriteSyncedData(byte[] data, ref int index, NetworkEventType eventType)
{
return true;
} }
public PacManFruitType FruitType public PacManFruitType FruitType
@@ -110,7 +101,7 @@ namespace Marro.PacManUdon
get => active; get => active;
} }
private readonly DataDictionary fruitScoreValue = new DataDictionary() private DataDictionary fruitScoreValue = new DataDictionary()
{ {
{(int)PacManFruitType.None , 0}, {(int)PacManFruitType.None , 0},
{(int)PacManFruitType.Cherries , 100}, {(int)PacManFruitType.Cherries , 100},
@@ -122,5 +113,6 @@ namespace Marro.PacManUdon
{(int)PacManFruitType.Bell , 3000}, {(int)PacManFruitType.Bell , 3000},
{(int)PacManFruitType.Key , 5000} {(int)PacManFruitType.Key , 5000}
}; };
} }
} }

View File

@@ -1,161 +0,0 @@
using System;
using UnityEngine;
namespace Marro.PacManUdon
{
public static class ByteUtils
{
public static void Append(this byte[] target, byte[] value, ref int index)
{
//Debug.Log($"ByteUtils Append {nameof(value)}.Length: {value.Length}, {nameof(target)}.Length : {target.Length}, {nameof(index)}: {index}");
Array.Copy(value, 0, target, index, value.Length);
index += value.Length;
}
public static void Append(this byte[] target, byte value, ref int index) =>
target[index++] = value;
public static void Append(this byte[] target, sbyte value, ref int index) =>
target[index++] = (byte)value;
public static void Append(this byte[] target, bool value, ref int index) =>
target[index++] = value ? (byte)1 : (byte)0;
public static void Append(this byte[] target, ushort value, ref int index) =>
target.Append(BitConverter.GetBytes(value), ref index);
public static void Append(this byte[] target, short value, ref int index) =>
target.Append(BitConverter.GetBytes(value), ref index);
public static void Append(this byte[] target, uint value, ref int index) =>
target.Append(BitConverter.GetBytes(value), ref index);
public static void Append(this byte[] target, int value, ref int index) =>
target.Append(BitConverter.GetBytes(value), ref index);
/// <summary>
/// Casts <paramref name="value"/> to a byte and then appends it.
/// Safer than doing <c>Append((byte)value, ref index)</c>, which can crash the Udonbehaviour.
/// </summary>
public static void AppendAsByte(this byte[] target, int value, ref int index) =>
target.Append(value.ToByte(), ref index);
public static void Append(this byte[] target, ulong value, ref int index) =>
target.Append(BitConverter.GetBytes(value), ref index);
public static void Append(this byte[] target, long value, ref int index) =>
target.Append(BitConverter.GetBytes(value), ref index);
public static void Append(this byte[] target, float value, ref int index) =>
target.Append(BitConverter.GetBytes(value), ref index);
public static void Append(this byte[] target, double value, ref int index) =>
target.Append(BitConverter.GetBytes(value), ref index);
public static void Append(this byte[] target, char value, ref int index) =>
target.Append(BitConverter.GetBytes(value), ref index);
public static void Append(this byte[] target, Vector2 value, ref int index)
{
target.Append(value.x, ref index);
target.Append(value.y, ref index);
}
public static void Append(this byte[] target, Vector3 value, ref int index)
{
target.Append(value.x, ref index);
target.Append(value.y, ref index);
target.Append(value.z, ref index);
}
public static byte ReadByte(this byte[] source, ref int index) =>
source[index++];
public static bool ReadBool(this byte[] source, ref int index) =>
source[index++] > 0;
public static ushort ReadUShort(this byte[] source, ref int index)
{
var value = BitConverter.ToUInt16(source, index);
index += 2;
return value;
}
public static short ReadShort(this byte[] source, ref int index)
{
var value = BitConverter.ToInt16(source, (int)index);
index += 2;
return value;
}
public static uint ReadUInt(this byte[] source, ref int index)
{
var value = BitConverter.ToUInt32(source, index);
index += 4;
return value;
}
public static int ReadInt(this byte[] source, ref int index)
{
var value = BitConverter.ToInt32(source, index);
index += 4;
return value;
}
public static ulong ReadULong(this byte[] source, ref int index)
{
var value = BitConverter.ToUInt64(source, index);
index += 8;
return value;
}
public static long ReadLong(this byte[] source, ref int index)
{
var value = BitConverter.ToInt64(source, index);
index += 8;
return value;
}
public static float ReadFloat(this byte[] source, ref int index)
{
var value = BitConverter.ToSingle(source, index);
index += 4;
return value;
}
public static double ReadDouble(this byte[] source, ref int index)
{
var value = BitConverter.ToDouble(source, index);
index += 8;
return value;
}
public static char ReadChar(this byte[] source, ref int index)
{
var value = BitConverter.ToChar(source, index);
index += 2;
return value;
}
public static Vector2 ReadVector2(this byte[] source, ref int index)
{
var value = new Vector2(BitConverter.ToSingle(source, index), BitConverter.ToSingle(source, index + 4));
index += 8;
return value;
}
public static Vector3 ReadVector3(this byte[] source, ref int index)
{
var value = new Vector3(BitConverter.ToSingle(source, index), BitConverter.ToSingle(source, index + 4), BitConverter.ToSingle(source, index + 8));
index += 12;
return value;
}
/// <summary>
/// Casts an Int32 to a byte.
/// Doing this inline sometimes causes an udon exception, but doing it via a separate method seems to work fine.
/// </summary>
public static byte ToByte(this int value) =>
(byte)value;
}
}

View File

@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 7d2126e683a87e241ad0399cefcda807
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,120 +1,120 @@
//namespace Marro.PacManUdon namespace Marro.PacManUdon
//{ {
// using System.Collections; using System.Collections;
// using System.Collections.Generic; using System.Collections.Generic;
// using UnityEngine; using UnityEngine;
// using UnityEditor.Animations; using UnityEditor.Animations;
// using UnityEditor; using UnityEditor;
// public class AnimationRecorder : MonoBehaviour public class AnimationRecorder : MonoBehaviour
// { {
// [SerializeField] AnimationClip clip; [SerializeField] AnimationClip clip;
// [SerializeField] GameObject root; [SerializeField] GameObject root;
// [SerializeField] GameObject[] gameObjectsToAnimate; [SerializeField] GameObject[] gameObjectsToAnimate;
// private GameObjectRecorder recorder; private GameObjectRecorder recorder;
// void Start() void Start()
// { {
// recorder = new GameObjectRecorder(root); recorder = new GameObjectRecorder(root);
// foreach (GameObject gameObject in gameObjectsToAnimate) foreach (GameObject gameObject in gameObjectsToAnimate)
// { {
// // if(gameObject.GetComponent<PacMan>() || gameObject.GetComponent<Ghost>()) // if(gameObject.GetComponent<PacMan>() || gameObject.GetComponent<Ghost>())
// // { // {
// // recorder.BindComponentsOfType<Transform>(gameObject, true); // recorder.BindComponentsOfType<Transform>(gameObject, true);
// // } // }
// // recorder.BindComponentsOfType<Renderer>(gameObject, true); // recorder.BindComponentsOfType<Renderer>(gameObject, true);
// string path = AnimationUtility.CalculateTransformPath(gameObject.transform, root.transform); string path = AnimationUtility.CalculateTransformPath(gameObject.transform, root.transform);
// recorder.Bind(EditorCurveBinding.FloatCurve(path, typeof(GameObject), "m_IsActive")); recorder.Bind(EditorCurveBinding.FloatCurve(path, typeof(GameObject), "m_IsActive"));
// Pellet pellet = gameObject.GetComponent<Pellet>(); Pellet pellet = gameObject.GetComponent<Pellet>();
// if (pellet) if (pellet)
// { {
// recorder.Bind(EditorCurveBinding.FloatCurve(path, typeof(SpriteRenderer), "m_Enabled")); recorder.Bind(EditorCurveBinding.FloatCurve(path, typeof(SpriteRenderer), "m_Enabled"));
// if (pellet.isPowerPellet) if (pellet.isPowerPellet)
// { {
// recorder.Bind(EditorCurveBinding.PPtrCurve(path, typeof(SpriteRenderer), "m_Sprite")); recorder.Bind(EditorCurveBinding.PPtrCurve(path, typeof(SpriteRenderer), "m_Sprite"));
// } }
// continue; continue;
// } }
// if (gameObject.GetComponent<SpriteRenderer>()) if (gameObject.GetComponent<SpriteRenderer>())
// { {
// recorder.Bind(EditorCurveBinding.FloatCurve(path, typeof(SpriteRenderer), "m_Enabled")); recorder.Bind(EditorCurveBinding.FloatCurve(path, typeof(SpriteRenderer), "m_Enabled"));
// recorder.Bind(EditorCurveBinding.PPtrCurve(path, typeof(SpriteRenderer), "m_Sprite")); recorder.Bind(EditorCurveBinding.PPtrCurve(path, typeof(SpriteRenderer), "m_Sprite"));
// } }
// else if (gameObject.GetComponent<MeshRenderer>()) else if (gameObject.GetComponent<MeshRenderer>())
// { {
// recorder.Bind(EditorCurveBinding.DiscreteCurve(path, typeof(MeshRenderer), "m_Enabled")); recorder.Bind(EditorCurveBinding.DiscreteCurve(path, typeof(MeshRenderer), "m_Enabled"));
// } }
// recorder.Bind(EditorCurveBinding.FloatCurve(path, typeof(Transform), "m_LocalPosition.x")); recorder.Bind(EditorCurveBinding.FloatCurve(path, typeof(Transform), "m_LocalPosition.x"));
// recorder.Bind(EditorCurveBinding.FloatCurve(path, typeof(Transform), "m_LocalPosition.y")); recorder.Bind(EditorCurveBinding.FloatCurve(path, typeof(Transform), "m_LocalPosition.y"));
// recorder.Bind(EditorCurveBinding.FloatCurve(path, typeof(Transform), "m_LocalPosition.z")); recorder.Bind(EditorCurveBinding.FloatCurve(path, typeof(Transform), "m_LocalPosition.z"));
// } }
// EditorCurveBinding[] bindings = recorder.GetBindings(); EditorCurveBinding[] bindings = recorder.GetBindings();
// foreach (EditorCurveBinding binding in bindings) foreach (EditorCurveBinding binding in bindings)
// { {
// Debug.Log($"{binding.path}, {binding.propertyName}, {binding.type}"); Debug.Log($"{binding.path}, {binding.propertyName}, {binding.type}");
// } }
// } }
// private static string GetGameObjectPathToObject(GameObject obj, Transform target) private static string GetGameObjectPathToObject(GameObject obj, Transform target)
// { {
// string path = "/" + obj.name; string path = "/" + obj.name;
// while (!obj.transform.parent.Equals(target)) while (!obj.transform.parent.Equals(target))
// { {
// obj = obj.transform.parent.gameObject; obj = obj.transform.parent.gameObject;
// path = "/" + obj.name + path; path = "/" + obj.name + path;
// } }
// Debug.Log($"GetGameObjectPathToTransform from {obj} to {target.gameObject} gives {path}"); Debug.Log($"GetGameObjectPathToTransform from {obj} to {target.gameObject} gives {path}");
// return path; return path;
// } }
// void LateUpdate() void LateUpdate()
// { {
// if (clip == null) if (clip == null)
// return; return;
// recorder.TakeSnapshot(Time.deltaTime); recorder.TakeSnapshot(Time.deltaTime);
// } }
// void OnDisable() void OnDisable()
// { {
// if (clip == null) if (clip == null)
// return; return;
// if (recorder.isRecording) if (recorder.isRecording)
// { {
// recorder.SaveToClip(clip); recorder.SaveToClip(clip);
// RemoveUnneededCurves(clip); RemoveUnneededCurves(clip);
// } }
// } }
// private static void RemoveUnneededCurves(AnimationClip clip) private static void RemoveUnneededCurves(AnimationClip clip)
// { {
// // Collect curves to process // Collect curves to process
// EditorCurveBinding[] bindings = AnimationUtility.GetCurveBindings(clip); EditorCurveBinding[] bindings = AnimationUtility.GetCurveBindings(clip);
// List<EditorCurveBinding> unneededCurves = new List<EditorCurveBinding>(); List<EditorCurveBinding> unneededCurves = new List<EditorCurveBinding>();
// foreach (var binding in bindings) foreach (var binding in bindings)
// { {
// AnimationCurve curve = AnimationUtility.GetEditorCurve(clip, binding); AnimationCurve curve = AnimationUtility.GetEditorCurve(clip, binding);
// if (curve == null || curve.keys.Length <= 2) if (curve == null || curve.keys.Length <= 2)
// { {
// unneededCurves.Add(binding); unneededCurves.Add(binding);
// } }
// } }
// // Remove unchanged curves // Remove unchanged curves
// foreach (var binding in unneededCurves) foreach (var binding in unneededCurves)
// { {
// AnimationUtility.SetEditorCurve(clip, binding, null); AnimationUtility.SetEditorCurve(clip, binding, null);
// Debug.Log($"Removed unchanged curve for property: {binding.propertyName}"); Debug.Log($"Removed unchanged curve for property: {binding.propertyName}");
// } }
// } }
// } }
//} }

View File

@@ -43,25 +43,25 @@ MonoBehaviour:
Data: Data:
- Name: - Name:
Entry: 12 Entry: 12
Data: 11 Data: 10
- Name: - Name:
Entry: 7 Entry: 7
Data: Data:
- Name: $k - Name: $k
Entry: 1 Entry: 1
Data: networkManager Data: fruitType
- Name: $v - Name: $v
Entry: 7 Entry: 7
Data: 2|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor Data: 2|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField - Name: <Name>k__BackingField
Entry: 1 Entry: 1
Data: networkManager Data: fruitType
- Name: <UserType>k__BackingField - Name: <UserType>k__BackingField
Entry: 7 Entry: 7
Data: 3|System.RuntimeType, mscorlib Data: 3|System.RuntimeType, mscorlib
- Name: - Name:
Entry: 1 Entry: 1
Data: Marro.PacManUdon.NetworkManager, Assembly-CSharp Data: Marro.PacManUdon.PacManFruitType, Assembly-CSharp
- Name: - Name:
Entry: 8 Entry: 8
Data: Data:
@@ -70,7 +70,7 @@ MonoBehaviour:
Data: 4|System.RuntimeType, mscorlib Data: 4|System.RuntimeType, mscorlib
- Name: - Name:
Entry: 1 Entry: 1
Data: VRC.Udon.UdonBehaviour, VRC.Udon Data: System.Int32, mscorlib
- Name: - Name:
Entry: 8 Entry: 8
Data: Data:
@@ -78,8 +78,8 @@ MonoBehaviour:
Entry: 7 Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
- Name: - Name:
Entry: 6 Entry: 3
Data: Data: 1
- Name: - Name:
Entry: 8 Entry: 8
Data: Data:
@@ -91,67 +91,25 @@ MonoBehaviour:
Data: 5|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib Data: 5|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name: - Name:
Entry: 12 Entry: 12
Data: 0 Data: 3
- Name: - Name:
Entry: 13 Entry: 7
Data: Data: 6|UnityEngine.SerializeField, UnityEngine.CoreModule
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name: - Name:
Entry: 8 Entry: 8
Data: Data:
- Name: - Name:
Entry: 7 Entry: 7
Data: Data: 7|UdonSharp.UdonSyncedAttribute, UdonSharp.Runtime
- Name: $k
Entry: 1
Data: fruitType
- Name: $v
Entry: 7
Data: 6|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: fruitType
- Name: <UserType>k__BackingField
Entry: 7
Data: 7|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: Marro.PacManUdon.PacManFruitType, Assembly-CSharp
- Name: - Name:
Entry: 8 Entry: 8
Data: Data:
- Name: <SystemType>k__BackingField
Entry: 7
Data: 8|System.RuntimeType, mscorlib
- Name: - Name:
Entry: 1 Entry: 7
Data: System.Int32, mscorlib Data: 8|UdonSharp.FieldChangeCallbackAttribute, UdonSharp.Runtime
- Name: - Name:
Entry: 8 Entry: 8
Data: Data:
- 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: 9|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 0
- Name: - Name:
Entry: 13 Entry: 13
Data: Data:
@@ -172,13 +130,13 @@ MonoBehaviour:
Data: animator Data: animator
- Name: $v - Name: $v
Entry: 7 Entry: 7
Data: 10|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor Data: 9|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField - Name: <Name>k__BackingField
Entry: 1 Entry: 1
Data: animator Data: animator
- Name: <UserType>k__BackingField - Name: <UserType>k__BackingField
Entry: 7 Entry: 7
Data: 11|System.RuntimeType, mscorlib Data: 10|System.RuntimeType, mscorlib
- Name: - Name:
Entry: 1 Entry: 1
Data: UnityEngine.Animator, UnityEngine.AnimationModule Data: UnityEngine.Animator, UnityEngine.AnimationModule
@@ -187,7 +145,7 @@ MonoBehaviour:
Data: Data:
- Name: <SystemType>k__BackingField - Name: <SystemType>k__BackingField
Entry: 9 Entry: 9
Data: 11 Data: 10
- Name: <SyncMode>k__BackingField - Name: <SyncMode>k__BackingField
Entry: 7 Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -202,7 +160,7 @@ MonoBehaviour:
Data: false Data: false
- Name: _fieldAttributes - Name: _fieldAttributes
Entry: 7 Entry: 7
Data: 12|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib Data: 11|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name: - Name:
Entry: 12 Entry: 12
Data: 0 Data: 0
@@ -226,13 +184,13 @@ MonoBehaviour:
Data: renderer Data: renderer
- Name: $v - Name: $v
Entry: 7 Entry: 7
Data: 13|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor Data: 12|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField - Name: <Name>k__BackingField
Entry: 1 Entry: 1
Data: renderer Data: renderer
- Name: <UserType>k__BackingField - Name: <UserType>k__BackingField
Entry: 7 Entry: 7
Data: 14|System.RuntimeType, mscorlib Data: 13|System.RuntimeType, mscorlib
- Name: - Name:
Entry: 1 Entry: 1
Data: UnityEngine.Renderer, UnityEngine.CoreModule Data: UnityEngine.Renderer, UnityEngine.CoreModule
@@ -241,7 +199,7 @@ MonoBehaviour:
Data: Data:
- Name: <SystemType>k__BackingField - Name: <SystemType>k__BackingField
Entry: 9 Entry: 9
Data: 14 Data: 13
- Name: <SyncMode>k__BackingField - Name: <SyncMode>k__BackingField
Entry: 7 Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -256,7 +214,7 @@ MonoBehaviour:
Data: false Data: false
- Name: _fieldAttributes - Name: _fieldAttributes
Entry: 7 Entry: 7
Data: 15|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib Data: 14|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name: - Name:
Entry: 12 Entry: 12
Data: 0 Data: 0
@@ -280,13 +238,13 @@ MonoBehaviour:
Data: collider Data: collider
- Name: $v - Name: $v
Entry: 7 Entry: 7
Data: 16|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor Data: 15|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField - Name: <Name>k__BackingField
Entry: 1 Entry: 1
Data: collider Data: collider
- Name: <UserType>k__BackingField - Name: <UserType>k__BackingField
Entry: 7 Entry: 7
Data: 17|System.RuntimeType, mscorlib Data: 16|System.RuntimeType, mscorlib
- Name: - Name:
Entry: 1 Entry: 1
Data: UnityEngine.Collider, UnityEngine.PhysicsModule Data: UnityEngine.Collider, UnityEngine.PhysicsModule
@@ -295,7 +253,7 @@ MonoBehaviour:
Data: Data:
- Name: <SystemType>k__BackingField - Name: <SystemType>k__BackingField
Entry: 9 Entry: 9
Data: 17 Data: 16
- Name: <SyncMode>k__BackingField - Name: <SyncMode>k__BackingField
Entry: 7 Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -310,7 +268,7 @@ MonoBehaviour:
Data: false Data: false
- Name: _fieldAttributes - Name: _fieldAttributes
Entry: 7 Entry: 7
Data: 18|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib Data: 17|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name: - Name:
Entry: 12 Entry: 12
Data: 0 Data: 0
@@ -334,13 +292,13 @@ MonoBehaviour:
Data: scoreBonusDisplay Data: scoreBonusDisplay
- Name: $v - Name: $v
Entry: 7 Entry: 7
Data: 19|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor Data: 18|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField - Name: <Name>k__BackingField
Entry: 1 Entry: 1
Data: scoreBonusDisplay Data: scoreBonusDisplay
- Name: <UserType>k__BackingField - Name: <UserType>k__BackingField
Entry: 7 Entry: 7
Data: 20|System.RuntimeType, mscorlib Data: 19|System.RuntimeType, mscorlib
- Name: - Name:
Entry: 1 Entry: 1
Data: Marro.PacManUdon.ScoreBonusDisplay, Assembly-CSharp Data: Marro.PacManUdon.ScoreBonusDisplay, Assembly-CSharp
@@ -348,8 +306,14 @@ MonoBehaviour:
Entry: 8 Entry: 8
Data: Data:
- Name: <SystemType>k__BackingField - Name: <SystemType>k__BackingField
Entry: 9 Entry: 7
Data: 4 Data: 20|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: VRC.Udon.UdonBehaviour, VRC.Udon
- Name:
Entry: 8
Data:
- Name: <SyncMode>k__BackingField - Name: <SyncMode>k__BackingField
Entry: 7 Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -454,10 +418,10 @@ MonoBehaviour:
Data: value Data: value
- Name: <UserType>k__BackingField - Name: <UserType>k__BackingField
Entry: 9 Entry: 9
Data: 8 Data: 4
- Name: <SystemType>k__BackingField - Name: <SystemType>k__BackingField
Entry: 9 Entry: 9
Data: 8 Data: 4
- Name: <SyncMode>k__BackingField - Name: <SyncMode>k__BackingField
Entry: 7 Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib

File diff suppressed because it is too large Load Diff

View File

@@ -1,9 +1,17 @@
using UdonSharp; #define RECORDING_DEMO
using UnityEngine;
namespace Marro.PacManUdon namespace Marro.PacManUdon
{ {
public partial class GameManager : SyncedObject using System;
using UdonSharp;
using UnityEngine;
using VRC.SDKBase;
using VRC.Udon;
using VRC.SDK3.Components;
using VRC.Udon.Common.Interfaces;
using VRC.SDK3.Data;
public partial class GameManager : UdonSharpBehaviour
{ {
[Header("Static game components")] [Header("Static game components")]
[SerializeField] private Maze[] mazes; [SerializeField] private Maze[] mazes;
@@ -11,33 +19,38 @@ namespace Marro.PacManUdon
[SerializeField] private GhostManager ghostManager; [SerializeField] private GhostManager ghostManager;
[SerializeField] private BonusFruit bonusFruit; [SerializeField] private BonusFruit bonusFruit;
[SerializeField] private PelletManager pelletManager; [SerializeField] private PelletManager pelletManager;
[SerializeField] private StatusDisplay statusDisplay; [SerializeField] public StatusDisplay statusDisplay; // This one is public so other scripts can write to the debug display
[SerializeField] private PelletManager attractScreen; [SerializeField] private PelletManager attractScreen;
[SerializeField] private GameObject intermissionScreen; [SerializeField] private GameObject intermissionScreen;
[SerializeField] private GameObject pressStartButtonScreen; [SerializeField] private GameObject pressStartButtonScreen;
[SerializeField] private PlayerInput playerInput; [SerializeField] private PlayerInput playerInput;
[SerializeField] private Animator demo; [SerializeField] private Animator demo;
[SerializeField] private SoundManager soundManager; [SerializeField] private SoundManager soundManager;
[SerializeField] private NetworkManager networkManagerSetup;
[SerializeField] private GameObject recorder; [SerializeField] private GameObject recorder;
[Header("Game settings")] [Header("Game settings")]
[SerializeField] private int startingExtraLives = 3; [SerializeField] private int startingExtraLives = 3;
[SerializeField] private int scoreToExtraLife = 10000; [SerializeField] private int scoreToExtraLife = 10000;
[Tooltip("Override amount of pellets needed to clear stage, set to -1 to disable.")]
[SerializeField] private int pelletCountOverride = -1;
private Maze maze; private Maze maze;
private VRCObjectPool pelletPool;
private Intermission2Pole intermission2Pole; private Intermission2Pole intermission2Pole;
private Animator mazeSpriteAnimator; private Animator mazeSpriteAnimator;
private int pelletCountTotal;
private int pelletCountRemaining;
private GameObject[] attractScreenElements; private GameObject[] attractScreenElements;
private GameObject[] intermissionScreenElements; private GameObject[] intermissionScreenElements;
private PacManGameState gameState; [UdonSynced, FieldChangeCallback(nameof(GameState))] private PacManGameState gameState;
private int score; [UdonSynced, FieldChangeCallback(nameof(Score))] private int score;
private int level; [UdonSynced, FieldChangeCallback(nameof(Level))] private int level;
private int highScore; [UdonSynced, FieldChangeCallback(nameof(HighScore))] private int highScore;
private int extraLives; [UdonSynced, FieldChangeCallback(nameof(ExtraLives))] private int extraLives;
public void Start() public void Start()
{ {
@@ -54,14 +67,14 @@ namespace Marro.PacManUdon
} }
maze = mazes[0]; maze = mazes[0];
pelletPool = maze.pelletContainer.GetComponent<VRCObjectPool>();
mazeSpriteAnimator = maze.mazeSprite.GetComponent<Animator>(); mazeSpriteAnimator = maze.mazeSprite.GetComponent<Animator>();
intermission2Pole = intermissionScreenElements[4].GetComponent<Intermission2Pole>(); intermission2Pole = intermissionScreenElements[4].GetComponent<Intermission2Pole>();
networkManager.Initialize(); ghostManager.Initialize(maze.ghostTargets, pacMan, this);
ghostManager.Initialize(maze.ghostStarts, maze.ghostTargets, pacMan, pelletManager, this); pacMan.Initialize(playerInput, pelletPool, this);
pacMan.Initialize(playerInput, maze.pacManStart, this);
bonusFruit.Initialize(); bonusFruit.Initialize();
pelletManager.Initialize(); pelletManager.Initialize(pelletPool);
statusDisplay.Initialize(); statusDisplay.Initialize();
playerInput.Initialize(this); playerInput.Initialize(this);
soundManager.Initialize(); soundManager.Initialize();
@@ -76,9 +89,9 @@ namespace Marro.PacManUdon
StartAttractMode(); StartAttractMode();
} }
public override void SyncedUpdate() public void FixedUpdate()
{ {
TimeSequenceUpdate(networkManager.SyncedDeltaTime); TimeSequenceUpdate(Time.deltaTime);
} }
public void JoystickGrabbed() public void JoystickGrabbed()
@@ -102,23 +115,39 @@ namespace Marro.PacManUdon
public void StartGameButtonPressed() public void StartGameButtonPressed()
{ {
Debug.Log($"{gameObject} Start Game Button was pressed!"); Debug.Log($"{gameObject} Start Game Button was pressed!");
if (networkManager.IsOwner) TakeOwnership();
{
networkManager.SendEventNow(NetworkEventType.StartGameButtonPressed);
}
StartTimeSequence(PacManTimeSequence.StartNewGame); StartTimeSequence(PacManTimeSequence.StartNewGame);
} }
public void SkipLevelButtonPressed()
{
if (Networking.IsOwner(gameObject))
{
Debug.Log($"{gameObject} Skip level button pressed!");
StartTimeSequence(PacManTimeSequence.BoardClear);
TimeSequenceSkipToNextStep();
}
}
public void StartDemoButtonPressed()
{
if (Networking.IsOwner(gameObject))
{
Debug.Log($"{gameObject} Start demo button pressed!");
StartTimeSequence(PacManTimeSequence.Intermission1);
}
}
private void StartAttractMode() private void StartAttractMode()
{ {
// #if RECORDING_DEMO // #if RECORDING_DEMO
// recorder.gameObject.SetActive(true); // recorder.gameObject.SetActive(true);
StartTimeSequence(PacManTimeSequence.AttractScreenIntroduction); StartTimeSequence(PacManTimeSequence.AttractScreenIntroduction);
// #else // #else
// SetGameState(PacManGameState.AttractMode); // SetGameState(PacManGameState.AttractMode);
// HideEverything(); // HideEverything();
// demo.gameObject.SetActive(true); // demo.gameObject.SetActive(true);
// #endif // #endif
} }
private void InitializeNewGame() private void InitializeNewGame()
@@ -133,20 +162,30 @@ namespace Marro.PacManUdon
{ {
Debug.Log($"{gameObject} New level started!"); Debug.Log($"{gameObject} New level started!");
pelletManager.RestoreAllPellets(); if (Networking.IsOwner(gameObject))
{
pelletCountTotal = pelletPool.Pool.Length;
pelletCountRemaining = pelletCountTotal;
ghostManager.SetPelletsRemaining(pelletCountRemaining);
ghostManager.NewLevel(); ghostManager.NewLevel();
pelletManager.RestoreAllPellets();
if (pelletCountOverride > 0)
{
pelletCountRemaining = pelletCountOverride;
}
}
mazeSpriteAnimator.SetBool("Blinking", false); mazeSpriteAnimator.SetBool("Blinking", false);
} }
private void RestartLevel(bool afterLifeLost = false) private void RestartLevel()
{ {
Debug.Log($"{gameObject} (Re)started level!"); Debug.Log($"{gameObject} (Re)started level!");
// SetInGameComponentVisibility(true); // SetInGameComponentVisibility(true);
ghostManager.RestartLevel(afterLifeLost); ghostManager.Reset();
pacMan.Reset(); pacMan.Reset();
bonusFruit.Despawn(); bonusFruit.Despawn();
soundManager.Reset(); soundManager.Reset();
@@ -160,40 +199,36 @@ namespace Marro.PacManUdon
SetFrozen(true); SetFrozen(true);
} }
public void GotPellet(Pellet pellet, bool addScore = true) public void GotPellet(bool addScore = true)
{ {
var pelletCollectedCount = pelletManager.PelletCollected(pellet); pelletCountRemaining--;
if (addScore) AddScore(10); if (addScore) AddScore(10);
ghostManager.PelletConsumed(); ghostManager.PelletConsumed();
soundManager.PlayPelletSound(); soundManager.PlayPelletSound();
var pelletCountRemaining = pelletManager.PelletCount - pelletCollectedCount;
soundManager.UpdatePelletCount(pelletCountRemaining); soundManager.UpdatePelletCount(pelletCountRemaining);
int pelletsConsumed = pelletCountTotal - pelletCountRemaining;
if (pelletCountRemaining <= 0) if (pelletCountRemaining <= 0)
{ {
StartTimeSequence(PacManTimeSequence.BoardClear); StartTimeSequence(PacManTimeSequence.BoardClear);
} }
else if (pelletCollectedCount == 70 || pelletCollectedCount == 170) else if (pelletsConsumed == 70 || pelletsConsumed == 170)
{ {
bonusFruit.Spawn(); bonusFruit.Spawn();
} }
} }
public void GotPowerPellet(Pellet pellet) public void GotPowerPellet()
{ {
Debug.Log($"{gameObject} GotPowerPellet");
if (gameState == PacManGameState.AttractMode) if (gameState == PacManGameState.AttractMode)
{ {
TimeSequenceSkipToNextStep(); TimeSequenceSkipToNextStep();
return; return;
} }
GotPellet(pellet, addScore: false); GotPellet(addScore: false);
AddScore(50); AddScore(50);
ghostManager.SetPowerPellet(true); ghostManager.SetPowerPellet(true);
pacMan.SetPowerPellet(true); pacMan.SetPowerPellet(true);
@@ -215,8 +250,6 @@ namespace Marro.PacManUdon
public void GhostCaught(int scoreBonus) public void GhostCaught(int scoreBonus)
{ {
Debug.Log($"{gameObject} GhostCaught");
if (gameState == PacManGameState.AttractMode) if (gameState == PacManGameState.AttractMode)
{ {
TimeSequenceSkipToNextStep(); TimeSequenceSkipToNextStep();
@@ -230,7 +263,6 @@ namespace Marro.PacManUdon
public void PacManCaught() public void PacManCaught()
{ {
return;
StartTimeSequence(PacManTimeSequence.PacManCaught); StartTimeSequence(PacManTimeSequence.PacManCaught);
} }
@@ -246,8 +278,6 @@ namespace Marro.PacManUdon
public void Intermission2PoleUpdate() public void Intermission2PoleUpdate()
{ {
Debug.Log($"{gameObject} Intermission2PoleUpdate");
TimeSequenceSkipToNextStep(); TimeSequenceSkipToNextStep();
} }
@@ -276,7 +306,7 @@ namespace Marro.PacManUdon
void SetPelletsActive(bool active) void SetPelletsActive(bool active)
{ {
pelletManager.gameObject.SetActive(active); pelletPool.gameObject.SetActive(active);
} }
void SetMazeVisible(bool visible) void SetMazeVisible(bool visible)
@@ -308,6 +338,10 @@ namespace Marro.PacManUdon
{ {
// Debug.Log($"{gameObject} State transitioning from {gameState} to {newGameState}"); // Debug.Log($"{gameObject} State transitioning from {gameState} to {newGameState}");
gameState = newGameState; gameState = newGameState;
if (Networking.IsOwner(gameObject))
{
RequestSerialization();
}
} }
private void IncrementLevel() private void IncrementLevel()
@@ -337,6 +371,7 @@ namespace Marro.PacManUdon
} }
SetScore(this.score + score); SetScore(this.score + score);
RequestSerialization();
} }
void SetScore(int score) void SetScore(int score)
@@ -358,12 +393,20 @@ namespace Marro.PacManUdon
public void DecrementLives() public void DecrementLives()
{ {
if (!Networking.IsOwner(gameObject))
{
return;
}
// Debug.Log($"{gameObject} Decremented lives from {extraLives} to {extraLives - 1}"); // Debug.Log($"{gameObject} Decremented lives from {extraLives} to {extraLives - 1}");
SetExtraLives(extraLives - 1); SetExtraLives(extraLives - 1);
} }
void IncrementLives() void IncrementLives()
{ {
if (!Networking.IsOwner(gameObject))
{
return;
}
// Debug.Log($"{gameObject} Incremented lives from {extraLives} to {extraLives + 1}"); // Debug.Log($"{gameObject} Incremented lives from {extraLives} to {extraLives + 1}");
SetExtraLives(extraLives + 1); SetExtraLives(extraLives + 1);
} }
@@ -394,34 +437,66 @@ namespace Marro.PacManUdon
} }
} }
public override void CollectSyncedData(byte[] data, ref int offset, NetworkEventType eventType) void TakeOwnership()
{ {
//data[offset++] = new byte[] { NetworkManager.Int32ToByte((int)gameState) }; Networking.SetOwner(Networking.LocalPlayer, gameObject);
//data[offset++] = BitConverter.GetBytes(currentlyInTimeSequence); Networking.SetOwner(Networking.LocalPlayer, pacMan.gameObject);
//data[offset++] = new byte[] { NetworkManager.Int32ToByte((int)currentTimeSequence) }; Networking.SetOwner(Networking.LocalPlayer, pelletPool.gameObject);
//data[offset++] = BitConverter.GetBytes(timeSequenceSecondsPassed); ghostManager.SetOwner(Networking.LocalPlayer);
} }
public override bool WriteSyncedData(byte[] data, ref int offset, NetworkEventType eventType) public int ExtraLives
{ {
if (eventType == NetworkEventType.StartGameButtonPressed) set
{ {
StartGameButtonPressed(); SetExtraLives(value);
}
get => extraLives;
} }
//SetGameState((PacManGameState)data[offset++]); public PacManGameState GameState
{
//var currentlyInTimeSequence = BitConverter.ToBoolean(data, offset++); set
//var currentTimeSequence = (PacManTimeSequence)data[offset++]; {
//var timeSequenceSecondsPassed = BitConverter.ToSingle(data, offset); SetGameState(value);
//offset += 4; }
//TimeSequenceSyncWithRemote(currentlyInTimeSequence, currentTimeSequence, timeSequenceSecondsPassed); get => gameState;
return true;
} }
public PacManGameState GameState => gameState; public bool GhostsScared
{
set
{
public int Level => level; }
get => GhostsScared;
}
public int Score
{
set
{
SetScore(value);
}
get => score;
}
public int HighScore
{
set
{
SetHighScore(value);
}
get => score;
}
public int Level
{
set
{
SetLevel(value);
}
get => level;
}
} }
} }

File diff suppressed because it is too large Load Diff

View File

@@ -1,8 +1,15 @@
using System; #define RECORDING_DEMO
using UnityEngine;
namespace Marro.PacManUdon namespace Marro.PacManUdon
{ {
using UdonSharp;
using System;
using UnityEngine;
using VRC.SDKBase;
using VRC.Udon;
using VRC.SDK3.Components;
using VRC.Udon.Common.Interfaces;
enum PacManGhostType enum PacManGhostType
{ {
Caught, Caught,
@@ -32,14 +39,11 @@ namespace Marro.PacManUdon
TargetingIdlePosition2 TargetingIdlePosition2
} }
[RequireComponent(typeof(Renderer))]
[RequireComponent(typeof(Animator))]
public class Ghost : GridMover public class Ghost : GridMover
{ {
[SerializeField] private PacManGhostType ghostType; [SerializeField] private PacManGhostType ghostType;
[SerializeField] private PacManGhostStartState startState; [SerializeField] private PacManGhostStartState startState;
// External references
private GhostManager ghostManager; private GhostManager ghostManager;
private Animator animator; private Animator animator;
private new Renderer renderer; private new Renderer renderer;
@@ -49,46 +53,42 @@ namespace Marro.PacManUdon
private Vector3 startPosition; private Vector3 startPosition;
private Quaternion startRotation; private Quaternion startRotation;
private Vector3 startScale;
private Vector2 homePosition; private Vector2 homePosition;
private Vector2 idlePosition1; private Vector2 idlePosition1;
private Vector2 idlePosition2; private Vector2 idlePosition2;
private Vector2 cornerPosition; private Vector2 cornerPosition;
// Pathfinding
private Vector2 target;
private bool horizontalOnly;
private bool inTunnel;
private int rngState;
private bool turnAroundSoon;
private float speed;
// State
private PacManGhostState ghostState;
private bool isScared;
private bool scattering;
private PacManGhostFrozenState frozenState;
// Home
private bool offGrid;
private int housePelletCounter;
private bool housePelletCounterActive;
private int housePelletCounterLimit;
private bool faceInStartingDirectionUntilUnfrozen;
// Cutscene
private bool kinematic; private bool kinematic;
private bool horizontalOnly;
private int housePelletCounterLimit;
private bool faceInStartingDirectionUntilUnfrozen;
private bool specialLook; private bool specialLook;
private bool followingPredefinedPath; private bool followingPredefinedPath;
private Vector2[] predefinedPath; private Vector2[] predefinedPath;
private int predefinedPathIndex; private int predefinedPathIndex;
public bool IsScared => isScared; [UdonSynced] int rngState;
public int Index { get; private set; } [UdonSynced] private Vector2 syncedPosition;
[UdonSynced] private float speed;
[UdonSynced] private Vector2 direction;
[UdonSynced] private Vector2 target;
[UdonSynced] private bool offGrid;
[UdonSynced] private bool inTunnel;
[UdonSynced] private PacManGhostState ghostState;
[UdonSynced] private bool isScared;
[UdonSynced] private bool scattering;
[UdonSynced] private PacManGhostFrozenState frozenState;
[UdonSynced] private bool hideUntilUnfrozen;
[UdonSynced] private int housePelletCounter;
[UdonSynced] private bool housePelletCounterActive;
[UdonSynced] private bool turnAroundSoon;
public void Initialize(PacMan pacMan, Ghost blinky, Transform startTransform, Vector2 homePosition, Vector2 idlePosition1, Vector2 idlePosition2, Vector2 cornerPosition, int index) public void Initialize(PacMan pacMan, Ghost blinky, Vector2 homePosition, Vector2 idlePosition1, Vector2 idlePosition2, Vector2 cornerPosition)
{ {
ghostManager = transform.parent.GetComponent<GhostManager>(); ghostManager = transform.parent.GetComponent<GhostManager>();
animator = GetComponent<Animator>(); animator = GetComponent<Animator>();
@@ -103,18 +103,21 @@ namespace Marro.PacManUdon
scoreBonusDisplay = transform.Find("ScoreBonusDisplay").gameObject.GetComponent<ScoreBonusDisplay>(); scoreBonusDisplay = transform.Find("ScoreBonusDisplay").gameObject.GetComponent<ScoreBonusDisplay>();
scoreBonusDisplay.Initialize(); scoreBonusDisplay.Initialize();
startPosition = startTransform.localPosition; startPosition = transform.localPosition;
startRotation = startTransform.localRotation; startRotation = transform.localRotation;
startScale = transform.localScale;
frozenState = PacManGhostFrozenState.Frozen; frozenState = PacManGhostFrozenState.Frozen;
// Debug.Log($"{gameObject} Begin localScale = {initialScale}");
Index = index;
} }
public void Reset() public void Reset()
{ {
// Debug.Log($"{gameObject} Reset!"); // Debug.Log($"{gameObject} Reset!");
transform.SetLocalPositionAndRotation(startPosition, startRotation); transform.localPosition = startPosition;
transform.localRotation = startRotation;
transform.localScale = startScale;
// Debug.Log($"{gameObject} Reset localScale = {transform.localScale}");
if (startState == PacManGhostStartState.Outside) if (startState == PacManGhostStartState.Outside)
{ {
@@ -143,20 +146,25 @@ namespace Marro.PacManUdon
faceInStartingDirectionUntilUnfrozen = true; faceInStartingDirectionUntilUnfrozen = true;
UpdateAnimator(); UpdateAnimator();
RequestSerialization();
// Debug.Log($"{gameObject} reset with state: {state}, target: {target}, offGrid: {offGrid}"); // Debug.Log($"{gameObject} reset with state: {state}, target: {target}, offGrid: {offGrid}");
} }
public override void SyncedUpdate() void FixedUpdate()
{ {
if (ghostType == PacManGhostType.Blinky)
{
// ghostManager.gameStateManager.statusDisplay.SetDebugText(2, $"{turnAroundSoon}");
}
if (frozenState == PacManGhostFrozenState.Frozen || if (frozenState == PacManGhostFrozenState.Frozen ||
(frozenState == PacManGhostFrozenState.FrozenIfNotCaught && ghostState != PacManGhostState.Returning && ghostState != PacManGhostState.Entering)) (frozenState == PacManGhostFrozenState.FrozenIfNotCaught && ((ghostState != PacManGhostState.Returning && ghostState != PacManGhostState.Entering) || hideUntilUnfrozen)))
{ {
return; return;
} }
Vector2 position = GetPosition(); Vector2 position = GetPosition();
Vector2 nextPosition = GridMoverTools.GetNextPosition(position, direction, speed, networkManager.SyncedDeltaTime); Vector2 nextPosition = GridMoverTools.GetNextPosition(position, direction, speed);
nextPosition = ProcessNextPosition(position, nextPosition); nextPosition = ProcessNextPosition(position, nextPosition);
@@ -168,10 +176,9 @@ namespace Marro.PacManUdon
if (turnAroundSoon && ghostState == PacManGhostState.Normal if (turnAroundSoon && ghostState == PacManGhostState.Normal
&& GridMoverTools.CrossesTileBorder(position, nextPosition, direction.x != 0, direction.y != 0)) && GridMoverTools.CrossesTileBorder(position, nextPosition, direction.x != 0, direction.y != 0))
{ {
// Debug.Log($"{gameObject} turned around");
SetDirection(direction * -1); SetDirection(direction * -1);
Debug.Log($"{gameObject} turned around to direction {GetDirection()}");
turnAroundSoon = false; turnAroundSoon = false;
return nextPosition;
} }
if (kinematic) if (kinematic)
@@ -222,23 +229,17 @@ namespace Marro.PacManUdon
{ {
target = GetGridTarget(gridPosition); target = GetGridTarget(gridPosition);
SetDirection(GetGridDirectionToTargetGreedy(availableDirections, gridPosition, target)); SetDirection(GetGridDirectionToTargetGreedy(availableDirections, gridPosition, target));
nextPosition = GridMoverTools.GetNextPosition(gridPosition, direction, speed, networkManager.SyncedDeltaTime); nextPosition = GridMoverTools.GetNextPosition(gridPosition, direction, speed);
// Debug.Log($"GetNextPosition at gridPosition {gridPosition} with direction {direction} and speed {speed} gives nextPosition {nextPosition}"); // Debug.Log($"GetNextPosition at gridPosition {gridPosition} with direction {direction} and speed {speed} gives nextPosition {nextPosition}");
} }
else if (availableDirections.Length == 1 && availableDirections[0] != direction) else if (availableDirections.Length == 1 && availableDirections[0] != direction)
{ {
SetDirection(availableDirections[0]); SetDirection(availableDirections[0]);
nextPosition = GridMoverTools.GetNextPosition(gridPosition, direction, speed, networkManager.SyncedDeltaTime); nextPosition = GridMoverTools.GetNextPosition(gridPosition, direction, speed);
} }
// Debug.Log($"{gameObject} crossed tile center {gridPosition}, new target: {target}, new direction: {direction}"); // Debug.Log($"{gameObject} crossed tile center {gridPosition}, new target: {target}, new direction: {direction}");
} }
var distance = Vector2.Distance(position, nextPosition);
if (distance > 0.5f)
{
Debug.LogError($"{gameObject} Just jumped by distance {distance}! position: {position}, nextPosition: {nextPosition}, direction: {direction}, offGrid: {offGrid}, ghostState: {ghostState}");
}
return nextPosition; return nextPosition;
} }
@@ -477,7 +478,7 @@ namespace Marro.PacManUdon
} }
} }
protected override void UpdateAnimator() private void UpdateAnimator()
{ {
if (!gameObject.activeInHierarchy) if (!gameObject.activeInHierarchy)
return; return;
@@ -638,6 +639,10 @@ namespace Marro.PacManUdon
ghostState = state; ghostState = state;
UpdateAnimator(); UpdateAnimator();
UpdateSpeed(); UpdateSpeed();
if (Networking.IsOwner(gameObject))
{
RequestSerialization();
}
} }
private void SetScared(bool scared) private void SetScared(bool scared)
@@ -650,6 +655,11 @@ namespace Marro.PacManUdon
{ {
SetWhite(false); SetWhite(false);
} }
if (Networking.IsOwner(gameObject))
{
RequestSerialization();
}
} }
public void SetScattering(bool scattering, bool reverseDirection = true) public void SetScattering(bool scattering, bool reverseDirection = true)
@@ -657,7 +667,7 @@ namespace Marro.PacManUdon
if (reverseDirection && this.scattering != scattering) if (reverseDirection && this.scattering != scattering)
{ {
if (ghostState == PacManGhostState.Normal || ghostState == PacManGhostState.Home || ghostState == PacManGhostState.Exiting if (ghostState == PacManGhostState.Normal || ghostState == PacManGhostState.Home || ghostState == PacManGhostState.Exiting
// This is afaik not normal PacMan behaviour, but is needed to accomidate slight timing differences during the demo // This is afaik not normal PacMan behaviour, but is needed to accomidate slight timing differences
|| ghostState == PacManGhostState.Entering && ghostManager.gameController.GameState == PacManGameState.AttractModeDemo || ghostState == PacManGhostState.Entering && ghostManager.gameController.GameState == PacManGameState.AttractModeDemo
) )
{ {
@@ -666,6 +676,7 @@ namespace Marro.PacManUdon
} }
this.scattering = scattering; this.scattering = scattering;
UpdateAnimator(); UpdateAnimator();
RequestSerialization();
} }
public void SetFrozen(bool frozen, bool ignoreIfCaught = false, bool keepAnimating = false) public void SetFrozen(bool frozen, bool ignoreIfCaught = false, bool keepAnimating = false)
@@ -770,72 +781,50 @@ namespace Marro.PacManUdon
return ghostState; return ghostState;
} }
public bool IsScared => isScared;
public override Vector2 GetPosition()
{
return (Vector2)transform.localPosition;
}
public override void SetPosition(Vector2 position)
{
GridMoverTools.SetPosition(position, transform);
}
public override Vector2 GetDirection()
{
return direction;
}
public void SetDirection(Vector2 direction)
{
this.direction = direction;
UpdateAnimator();
RequestSerialization();
}
public void SetSpeed(float speed) public void SetSpeed(float speed)
{ {
this.speed = speed; this.speed = speed;
UpdateAnimator(); UpdateAnimator();
} }
public override void CollectSyncedData(byte[] data, ref int index, NetworkEventType eventType) public override void OnPreSerialization()
{ {
if (eventType != NetworkEventType.GhostUpdate) syncedPosition = GetPosition();
{
return;
} }
data.Append(target, ref index); public override void OnDeserialization()
data.Append(horizontalOnly, ref index);
data.Append(inTunnel, ref index);
data.Append(rngState, ref index);
data.Append(turnAroundSoon, ref index);
data.Append(speed, ref index);
data.AppendAsByte((int)ghostState, ref index);
data.Append(isScared, ref index);
data.Append(scattering, ref index);
data.AppendAsByte((int)frozenState, ref index);
data.Append(offGrid, ref index);
data.AppendAsByte(housePelletCounter, ref index);
data.Append(housePelletCounterActive, ref index);
data.AppendAsByte(housePelletCounterLimit, ref index);
data.Append(faceInStartingDirectionUntilUnfrozen, ref index);
base.CollectSyncedData(data, ref index, eventType);
}
public override bool WriteSyncedData(byte[] data, ref int index, NetworkEventType eventType)
{ {
if (eventType != NetworkEventType.GhostUpdate) SetPosition(syncedPosition);
{ UpdateAnimator();
return true;
}
target = data.ReadVector2(ref index);
horizontalOnly = data.ReadBool(ref index);
inTunnel = data.ReadBool(ref index);
rngState = data.ReadInt(ref index);
turnAroundSoon = data.ReadBool(ref index);
Debug.Log($"{gameObject} turnAroundSoon = {turnAroundSoon}");
speed = data.ReadFloat(ref index);
ghostState = (PacManGhostState)data.ReadByte(ref index);
isScared = data.ReadBool(ref index);
scattering = data.ReadBool(ref index);
frozenState = (PacManGhostFrozenState)data.ReadByte(ref index);
offGrid = data.ReadBool(ref index);
housePelletCounter = data.ReadByte(ref index);
housePelletCounterActive = data.ReadBool(ref index);
housePelletCounterLimit = data.ReadByte(ref index);
faceInStartingDirectionUntilUnfrozen = data.ReadBool(ref index);
return base.WriteSyncedData(data, ref index, eventType);
} }
void OnTriggerEnter(Collider other) void OnTriggerEnter(Collider other)
{ {
if (other.gameObject.GetComponent<PacManGhostCollider>()) if (Networking.IsOwner(gameObject) && other.gameObject.GetComponent<PacManGhostCollider>())
{ {
if (isScared) if (isScared)
{ {
@@ -869,5 +858,14 @@ namespace Marro.PacManUdon
SetInTunnel(false); SetInTunnel(false);
} }
} }
PacManGhostState State
{
set
{
SetState(value);
}
get => ghostState;
}
} }
} }

File diff suppressed because it is too large Load Diff

View File

@@ -1,18 +1,18 @@
using System; namespace Marro.PacManUdon
using UnityEngine;
using VRC.SDK3.Data;
namespace Marro.PacManUdon
{ {
public class GhostManager : SyncedObject using System;
using UdonSharp;
using UnityEngine;
using VRC.SDKBase;
using VRC.Udon;
using VRC.SDK3.Data;
public class GhostManager : UdonSharpBehaviour
{ {
[NonSerialized] public GameManager gameController; [NonSerialized] public GameManager gameController;
private Ghost[] ghosts; private Ghost[] ghosts;
private Ghost blinky; private Ghost blinky;
private PelletManager pelletManager;
// Level constants // Level constants
private float speedDefault; private float speedDefault;
private float speedScared; private float speedScared;
@@ -24,59 +24,58 @@ namespace Marro.PacManUdon
private int elroy1PelletCount; private int elroy1PelletCount;
private int elroy2PelletCount; private int elroy2PelletCount;
private float powerPelletDuration;
private float[] scatterPattern;
private float pelletTimeoutLimit;
// Power Pellet logic // Power Pellet logic
private bool powerPelletActive; private bool powerPelletActive;
private float powerPelletDuration;
private float powerPelletCountdown; private float powerPelletCountdown;
private int powerPelletMultiplier; private int powerPelletMultiplier;
private DataList ghostScaredQueue; private DataList ghostScaredQueue;
// Blink logic // Blink logic
private const float blinkCycleRate = 0.233333333f; private float blinkCycleRate = 0.233333333f;
private bool blinkingActivated; private bool blinkingActivated;
private float blinkCountdown; private float blinkCountdown;
private bool blinkCurrentlyWhite; private bool blinkCurrentlyWhite;
// Scattering logic // Scattering logic
private float scatterCounter; private float scatterCounter;
private float[] scatterPattern;
private int scatterPatternIndex; private int scatterPatternIndex;
// Elroy logic // Elroy logic
public int elroyLevel; public int elroyLevel;
private int pelletsRemaining;
// Ghost house logic // Ghost house logic
private bool sharedPelletCounterActive; private bool sharedPelletCounterActive;
private int sharedPelletCounter; private int sharedPelletCounter;
private readonly int[] sharedPelletCounterReleaseValues = { 0, 7, 17, 32 }; private int[] sharedPelletCounterReleaseValues = { 0, 7, 17, 32 };
private float pelletTimeout; private float pelletTimeout;
private float pelletTimeoutLimit;
private bool frozen; private bool frozen;
private bool kinematic; private bool kinematic;
public void Initialize(Transform[] ghostStarts, Transform[] ghostTargets, PacMan pacMan, PelletManager pelletManager, GameManager gameController) // This should be called once when the game is initialized
public void Initialize(GameObject[] ghostTargets, PacMan pacMan, GameManager gameController)
{ {
this.gameController = gameController; this.gameController = gameController;
this.pelletManager = pelletManager;
ghosts = transform.GetComponentsInChildren<Ghost>(true); ghosts = transform.GetComponentsInChildren<Ghost>(true);
blinky = ghosts[0]; blinky = ghosts[0];
for (int ghostIndex = 0; ghostIndex < ghosts.Length; ghostIndex++) for (int ghostIndex = 0; ghostIndex < ghosts.Length; ghostIndex++)
{ {
Transform startTransform = ghostStarts[ghostIndex]; Vector2 homePosition = ghostTargets[0].transform.localPosition;
Vector2 homePosition = ghostTargets[0].localPosition; Vector2 idlePosition1 = ghostTargets[1 + ghostIndex * 3].transform.localPosition;
Vector2 idlePosition1 = ghostTargets[1 + ghostIndex * 3].localPosition; Vector2 idlePosition2 = ghostTargets[2 + ghostIndex * 3].transform.localPosition;
Vector2 idlePosition2 = ghostTargets[2 + ghostIndex * 3].localPosition; Vector2 cornerPosition = ghostTargets[3 + ghostIndex * 3].transform.localPosition;
Vector2 cornerPosition = ghostTargets[3 + ghostIndex * 3].localPosition;
ghosts[ghostIndex].Initialize(pacMan, blinky, startTransform, homePosition, idlePosition1, idlePosition2, cornerPosition, ghostIndex); ghosts[ghostIndex].Initialize(pacMan, blinky, homePosition, idlePosition1, idlePosition2, cornerPosition);
} }
} }
public void RestartLevel(bool afterLifeLost = false) // This should be called every time the level is reset
public void Reset()
{ {
ghostScaredQueue = new DataList(); ghostScaredQueue = new DataList();
powerPelletActive = false; powerPelletActive = false;
@@ -87,31 +86,32 @@ namespace Marro.PacManUdon
elroyLevel = 0; elroyLevel = 0;
kinematic = false; kinematic = false;
if (afterLifeLost)
{
SetSharedPelletCounterActive(true);
}
foreach (Ghost ghost in ghosts) foreach (Ghost ghost in ghosts)
{ {
ghost.Reset(); ghost.Reset();
} }
SetScattering(true, reverseDirection: false); SetScattering(true, reverseDirection: false);
RequestSerialization();
} }
public void NewLevel() public void NewLevel()
{ {
SetSharedPelletCounterActive(false); SetSharedPelletCounterActive(false);
UpdateElroyLevel();
foreach (Ghost ghost in ghosts) foreach (Ghost ghost in ghosts)
{ {
ghost.ResetHousePelletCounter(); ghost.ResetHousePelletCounter();
} }
} }
public override void SyncedUpdate() public void LifeLost()
{ {
SetSharedPelletCounterActive(true);
}
public void FixedUpdate()
{
// gameStateManager.statusDisplay.SetDebugText(1, this.blinkCountdown.ToString());
if (frozen || kinematic) if (frozen || kinematic)
{ {
return; return;
@@ -131,7 +131,7 @@ namespace Marro.PacManUdon
void UpdateScattering() void UpdateScattering()
{ {
scatterCounter += networkManager.SyncedDeltaTime; scatterCounter += Time.deltaTime;
if (scatterPatternIndex < scatterPattern.Length && scatterCounter >= scatterPattern[scatterPatternIndex]) if (scatterPatternIndex < scatterPattern.Length && scatterCounter >= scatterPattern[scatterPatternIndex])
{ {
// Debug.Log($"{gameObject} SetScattering: {scatterPatternIndex%1 == 0}, scatterCounter: {scatterCounter}, scatterPattern: {scatterPattern[scatterPatternIndex]}, scatterPatternIndex: {scatterPatternIndex}"); // Debug.Log($"{gameObject} SetScattering: {scatterPatternIndex%1 == 0}, scatterCounter: {scatterCounter}, scatterPattern: {scatterPattern[scatterPatternIndex]}, scatterPatternIndex: {scatterPatternIndex}");
@@ -142,7 +142,7 @@ namespace Marro.PacManUdon
void UpdatePowerPellet() void UpdatePowerPellet()
{ {
powerPelletCountdown -= networkManager.SyncedDeltaTime; powerPelletCountdown -= Time.deltaTime;
if (powerPelletCountdown <= 0) if (powerPelletCountdown <= 0)
{ {
gameController.EndPowerPellet(); // End power pellet gameController.EndPowerPellet(); // End power pellet
@@ -155,7 +155,7 @@ namespace Marro.PacManUdon
if (blinkingActivated) if (blinkingActivated)
{ {
blinkCountdown -= networkManager.SyncedDeltaTime; blinkCountdown -= Time.deltaTime;
if (blinkCountdown <= 0) if (blinkCountdown <= 0)
{ {
blinkCountdown += blinkCycleRate; blinkCountdown += blinkCycleRate;
@@ -166,8 +166,7 @@ namespace Marro.PacManUdon
void UpdatePelletTimeout() void UpdatePelletTimeout()
{ {
pelletTimeout += networkManager.SyncedDeltaTime; pelletTimeout += Time.deltaTime;
if (pelletTimeout >= pelletTimeoutLimit) if (pelletTimeout >= pelletTimeoutLimit)
{ {
pelletTimeout -= pelletTimeoutLimit; pelletTimeout -= pelletTimeoutLimit;
@@ -191,10 +190,7 @@ namespace Marro.PacManUdon
gameController.GhostCaught(0); gameController.GhostCaught(0);
return; return;
} }
// Debug.Log($"{gameObject} GhostCaughtQueue with ghost {ghost}"); // Debug.Log($"{gameObject} GhostCaughtQueue with ghost {ghost}");
//networkManager.SendEventSoon(NetworkEventType.GhostUpdate);
ghostScaredQueue.Add(ghost); ghostScaredQueue.Add(ghost);
GhostCaughtExecute(ghost); GhostCaughtExecute(ghost);
} }
@@ -316,18 +312,6 @@ namespace Marro.PacManUdon
public void SetLevel(int level) public void SetLevel(int level)
{ {
Debug.Log($"GhostManager: SetLevel {level}"); Debug.Log($"GhostManager: SetLevel {level}");
SetLevelConstants(level);
int[] privatePelletCounterReleaseValues = PacManConstants.GetGhostHousePrivatePelletCounterLimitForLevel(level);
for (int i = 0; i < ghosts.Length; i++)
{
ghosts[i].SetHousePelletCounterLimit(privatePelletCounterReleaseValues[i]);
RestartLevel(); // Reset needed to properly apply level
}
}
private void SetLevelConstants(int level)
{
speedDefault = PacManConstants.GetGhostDefaultSpeedForLevel(level); speedDefault = PacManConstants.GetGhostDefaultSpeedForLevel(level);
speedScared = PacManConstants.GetGhostScaredSpeedForLevel(level); speedScared = PacManConstants.GetGhostScaredSpeedForLevel(level);
speedReturn = 15f; speedReturn = 15f;
@@ -340,6 +324,22 @@ namespace Marro.PacManUdon
powerPelletDuration = PacManConstants.GetScaredDurationForLevel(level); powerPelletDuration = PacManConstants.GetScaredDurationForLevel(level);
scatterPattern = PacManConstants.GetScatterPatternForLevel(level); scatterPattern = PacManConstants.GetScatterPatternForLevel(level);
pelletTimeoutLimit = PacManConstants.GetGhostHousePelletTimeoutLimitForLevel(level); pelletTimeoutLimit = PacManConstants.GetGhostHousePelletTimeoutLimitForLevel(level);
int[] privatePelletCounterReleaseValues = PacManConstants.GetGhostHousePrivatePelletCounterLimitForLevel(level);
for (int i = 0; i < ghosts.Length; i++)
{
ghosts[i].SetHousePelletCounterLimit(privatePelletCounterReleaseValues[i]);
ghosts[i].Reset(); // Reset needed to properly apply level
}
}
public void SetOwner(VRCPlayerApi player)
{
Networking.SetOwner(player, gameObject);
foreach (Ghost ghost in ghosts)
{
Networking.SetOwner(player, ghost.gameObject);
}
} }
public float GetTargetSpeed(Ghost ghost, PacManGhostState ghostState, bool isScared, bool inTunnel) public float GetTargetSpeed(Ghost ghost, PacManGhostState ghostState, bool isScared, bool inTunnel)
@@ -379,7 +379,7 @@ namespace Marro.PacManUdon
Debug.Log($"{gameObject} SetScattering: {scattering}"); Debug.Log($"{gameObject} SetScattering: {scattering}");
foreach (Ghost ghost in ghosts) foreach (Ghost ghost in ghosts)
{ {
if (ghost == blinky && elroyLevel > 0) // Once blinky is elroy he no longer scatters if (ghost == blinky && pelletsRemaining <= elroy1PelletCount)
{ {
continue; continue;
} }
@@ -387,13 +387,15 @@ namespace Marro.PacManUdon
} }
} }
/// <summary> public void SetPelletsRemaining(int pelletsRemaining)
/// Whether to use the shared pellet counter for ghost exiting. {
/// Should be called before ghosts are reset. this.pelletsRemaining = pelletsRemaining;
/// </summary> UpdateElroyLevel();
}
void SetSharedPelletCounterActive(bool active) void SetSharedPelletCounterActive(bool active)
{ {
Debug.Log($"{gameObject} SetSharedPelletCounterActive {active}"); // Debug.Log($"{gameObject} SetSharedPelletCounterActive {active}");
sharedPelletCounterActive = active; sharedPelletCounterActive = active;
foreach (Ghost ghost in ghosts) foreach (Ghost ghost in ghosts)
{ {
@@ -403,9 +405,9 @@ namespace Marro.PacManUdon
public void PelletConsumed() public void PelletConsumed()
{ {
pelletTimeout = 0; SetPelletsRemaining(pelletsRemaining - 1);
UpdateElroyLevel(); pelletTimeout = 0;
if (sharedPelletCounterActive) if (sharedPelletCounterActive)
{ {
@@ -420,7 +422,6 @@ namespace Marro.PacManUdon
void IncrementSharedPelletCounter() void IncrementSharedPelletCounter()
{ {
sharedPelletCounter++; sharedPelletCounter++;
//Debug.Log($"Incremented shared pellet counter to {sharedPelletCounter}");
for (int ghostIndex = 0; ghostIndex < sharedPelletCounterReleaseValues.Length; ghostIndex++) for (int ghostIndex = 0; ghostIndex < sharedPelletCounterReleaseValues.Length; ghostIndex++)
{ {
Ghost ghost = ghosts[ghostIndex]; Ghost ghost = ghosts[ghostIndex];
@@ -452,13 +453,10 @@ namespace Marro.PacManUdon
void UpdateElroyLevel() void UpdateElroyLevel()
{ {
// Debug.Log($"{gameObject} Updating Elroy Level with pelletsRemaining {pelletsRemaining} with elroy2PelletCount {elroy2PelletCount} and elroy1PelletCount {elroy1PelletCount}"); // Debug.Log($"{gameObject} Updating Elroy Level with pelletsRemaining {pelletsRemaining} with elroy2PelletCount {elroy2PelletCount} and elroy1PelletCount {elroy1PelletCount}");
var oldElroyLevel = elroyLevel; int oldElroyLevel = elroyLevel;
var pelletsRemaining = pelletManager.PelletCount - pelletManager.PelletCollectedCount;
if (pelletsRemaining < elroy2PelletCount) elroyLevel = 2; if (pelletsRemaining < elroy2PelletCount) elroyLevel = 2;
else if (pelletsRemaining < elroy1PelletCount) elroyLevel = 1; else if (pelletsRemaining < elroy1PelletCount) elroyLevel = 1;
else elroyLevel = 0; else elroyLevel = 0;
if (elroyLevel != oldElroyLevel) if (elroyLevel != oldElroyLevel)
{ {
blinky.SetElroy(elroyLevel); blinky.SetElroy(elroyLevel);
@@ -483,106 +481,6 @@ namespace Marro.PacManUdon
} }
} }
public override void CollectSyncedData(byte[] data, ref int index, NetworkEventType eventType)
{
if (eventType != NetworkEventType.GhostUpdate)
{
return;
}
// Power Pellet logic
data.Append(powerPelletActive, ref index);
data.Append(powerPelletCountdown, ref index);
data.AppendAsByte(powerPelletMultiplier, ref index);
// Blink logic
data.Append(blinkingActivated, ref index);
data.Append(blinkCountdown, ref index);
data.Append(blinkCurrentlyWhite, ref index);
// Scattering logic
data.Append(scatterCounter, ref index);
data.AppendAsByte(scatterPatternIndex, ref index);
// Elroy logic
data.AppendAsByte(elroyLevel, ref index);
// Ghost house logic
data.Append(sharedPelletCounterActive, ref index);
data.AppendAsByte(sharedPelletCounter, ref index);
data.Append(pelletTimeout, ref index);
data.Append(frozen, ref index);
data.Append(kinematic, ref index);
data.AppendAsByte(gameController.Level, ref index);
var ghostScaredQueueArray = new byte[ghosts.Length];
for (int i = 0; i < ghostScaredQueueArray.Length; i++)
{
var add = ghostScaredQueue.TryGetValue(i, out var ghost);
if (!add)
{
ghostScaredQueueArray[i] = byte.MaxValue; // Add a terminator
break;
}
ghostScaredQueueArray[i] = (byte)((Ghost)ghost.Reference).Index;
}
Debug.Log($"{gameObject} Sent a ghostScareQueue of length {ghostScaredQueue.Count}");
data.Append(ghostScaredQueueArray, ref index);
}
public override bool WriteSyncedData(byte[] data, ref int index, NetworkEventType eventType)
{
if (eventType != NetworkEventType.GhostUpdate)
{
return true;
}
// Power Pellet logic
powerPelletActive = data.ReadBool(ref index);
powerPelletCountdown = data.ReadFloat(ref index);
powerPelletMultiplier = data.ReadByte(ref index);
// Blink logic
blinkingActivated = data.ReadBool(ref index);
blinkCountdown = data.ReadFloat(ref index);
blinkCurrentlyWhite = data.ReadBool(ref index);
// Scattering logic
scatterCounter = data.ReadFloat(ref index);
scatterPatternIndex = data.ReadByte(ref index);
// Elroy logic
elroyLevel = data.ReadByte(ref index);
// Ghost house logic
sharedPelletCounterActive = data.ReadBool(ref index);
sharedPelletCounter = data.ReadByte(ref index);
pelletTimeout = data.ReadFloat(ref index);
frozen = data.ReadBool(ref index);
kinematic = data.ReadBool(ref index);
var level = data.ReadByte(ref index);
SetLevelConstants(level);
ghostScaredQueue.Clear();
for (int i = 0; i < ghosts.Length; i++)
{
var ghostIndex = data[index + i];
if (ghostIndex > ghosts.Length) // Reached terminator
{
break;
}
ghostScaredQueue.Add(ghosts[ghostIndex]);
}
index += ghosts.Length;
Debug.Log($"{gameObject} Read back a ghostScareQueue of length {ghostScaredQueue.Count}");
return true;
}
public Ghost[] Ghosts public Ghost[] Ghosts
{ {
get => ghosts; get => ghosts;

View File

@@ -1,47 +1,26 @@
namespace Marro.PacManUdon namespace Marro.PacManUdon
{ {
using System; using System;
using UdonSharp;
using UnityEngine; using UnityEngine;
public abstract class GridMover : SyncedObject public abstract class GridMover : UdonSharpBehaviour
{ {
protected Vector2 direction;
public virtual Vector2 GetPosition() public virtual Vector2 GetPosition()
{ {
return (Vector2)transform.localPosition; Debug.LogError($"{gameObject} does not implement GetPosition");
return Vector2.zero;
} }
public virtual void SetPosition(Vector2 position) public virtual void SetPosition(Vector2 position)
{ {
transform.localPosition = new Vector3(position.x, position.y, transform.localPosition.z); Debug.LogError($"{gameObject} does not implement SetPosition");
} }
public virtual Vector2 GetDirection() public virtual Vector2 GetDirection()
{ {
return direction; Debug.LogError($"{gameObject} does not implement GetDirection");
} return Vector2.zero;
public void SetDirection(Vector2 direction)
{
this.direction = direction;
UpdateAnimator();
}
protected abstract void UpdateAnimator();
public override void CollectSyncedData(byte[] data, ref int index, NetworkEventType eventType)
{
data.Append(GetPosition(), ref index);
data.Append(GetDirection(), ref index);
}
public override bool WriteSyncedData(byte[] data, ref int index, NetworkEventType eventType)
{
SetPosition(data.ReadVector2(ref index));
SetDirection(data.ReadVector2(ref index));
return true;
} }
} }
} }

View File

@@ -5,11 +5,17 @@ namespace Marro.PacManUdon
public static class GridMoverTools public static class GridMoverTools
{ {
public static Vector2 GetNextPosition(Vector2 currentPosition, Vector2 direction, float speed, float deltaTime) public static Vector2 GetNextPosition(Vector2 currentPosition, Vector2 direction, float speed)
{ {
return currentPosition + direction * speed * deltaTime; return currentPosition + direction * speed * Time.deltaTime;
} }
public static void SetPosition(Vector2 position, Transform transform)
{
transform.localPosition = new Vector3(position.x, position.y, transform.localPosition.z);
}
public static Vector2 PositionToGrid(Vector2 position) public static Vector2 PositionToGrid(Vector2 position)
{ {
return new Vector2((float)Math.Round(position.x), (float)Math.Round(position.y)); return new Vector2((float)Math.Round(position.x), (float)Math.Round(position.y));

View File

@@ -43,37 +43,31 @@ MonoBehaviour:
Data: Data:
- Name: - Name:
Entry: 12 Entry: 12
Data: 5 Data: 4
- Name: - Name:
Entry: 7 Entry: 7
Data: Data:
- Name: $k - Name: $k
Entry: 1 Entry: 1
Data: networkManager Data: _animator
- Name: $v - Name: $v
Entry: 7 Entry: 7
Data: 2|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor Data: 2|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField - Name: <Name>k__BackingField
Entry: 1 Entry: 1
Data: networkManager Data: _animator
- Name: <UserType>k__BackingField - Name: <UserType>k__BackingField
Entry: 7 Entry: 7
Data: 3|System.RuntimeType, mscorlib Data: 3|System.RuntimeType, mscorlib
- Name: - Name:
Entry: 1 Entry: 1
Data: Marro.PacManUdon.NetworkManager, Assembly-CSharp Data: UnityEngine.Animator, UnityEngine.AnimationModule
- Name: - Name:
Entry: 8 Entry: 8
Data: Data:
- Name: <SystemType>k__BackingField - Name: <SystemType>k__BackingField
Entry: 7 Entry: 9
Data: 4|System.RuntimeType, mscorlib Data: 3
- Name:
Entry: 1
Data: VRC.Udon.UdonBehaviour, VRC.Udon
- Name:
Entry: 8
Data:
- Name: <SyncMode>k__BackingField - Name: <SyncMode>k__BackingField
Entry: 7 Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -85,10 +79,10 @@ MonoBehaviour:
Data: Data:
- Name: <IsSerialized>k__BackingField - Name: <IsSerialized>k__BackingField
Entry: 5 Entry: 5
Data: true Data: false
- Name: _fieldAttributes - Name: _fieldAttributes
Entry: 7 Entry: 7
Data: 5|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib Data: 4|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name: - Name:
Entry: 12 Entry: 12
Data: 0 Data: 0
@@ -109,25 +103,31 @@ MonoBehaviour:
Data: Data:
- Name: $k - Name: $k
Entry: 1 Entry: 1
Data: _animator Data: _gameManager
- Name: $v - Name: $v
Entry: 7 Entry: 7
Data: 6|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor Data: 5|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField - Name: <Name>k__BackingField
Entry: 1 Entry: 1
Data: _animator Data: _gameManager
- Name: <UserType>k__BackingField - Name: <UserType>k__BackingField
Entry: 7 Entry: 7
Data: 7|System.RuntimeType, mscorlib Data: 6|System.RuntimeType, mscorlib
- Name: - Name:
Entry: 1 Entry: 1
Data: UnityEngine.Animator, UnityEngine.AnimationModule Data: Marro.PacManUdon.GameManager, Assembly-CSharp
- Name: - Name:
Entry: 8 Entry: 8
Data: Data:
- Name: <SystemType>k__BackingField - Name: <SystemType>k__BackingField
Entry: 9 Entry: 7
Data: 7 Data: 7|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: VRC.Udon.UdonBehaviour, VRC.Udon
- Name:
Entry: 8
Data:
- Name: <SyncMode>k__BackingField - Name: <SyncMode>k__BackingField
Entry: 7 Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -163,25 +163,25 @@ MonoBehaviour:
Data: Data:
- Name: $k - Name: $k
Entry: 1 Entry: 1
Data: _gameManager Data: _ghost
- Name: $v - Name: $v
Entry: 7 Entry: 7
Data: 9|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor Data: 9|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField - Name: <Name>k__BackingField
Entry: 1 Entry: 1
Data: _gameManager Data: _ghost
- Name: <UserType>k__BackingField - Name: <UserType>k__BackingField
Entry: 7 Entry: 7
Data: 10|System.RuntimeType, mscorlib Data: 10|System.RuntimeType, mscorlib
- Name: - Name:
Entry: 1 Entry: 1
Data: Marro.PacManUdon.GameManager, Assembly-CSharp Data: Marro.PacManUdon.Ghost, Assembly-CSharp
- Name: - Name:
Entry: 8 Entry: 8
Data: Data:
- Name: <SystemType>k__BackingField - Name: <SystemType>k__BackingField
Entry: 9 Entry: 9
Data: 4 Data: 7
- Name: <SyncMode>k__BackingField - Name: <SyncMode>k__BackingField
Entry: 7 Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -217,70 +217,16 @@ MonoBehaviour:
Data: Data:
- Name: $k - Name: $k
Entry: 1 Entry: 1
Data: _ghost Data: _lastUpdate
- Name: $v - Name: $v
Entry: 7 Entry: 7
Data: 12|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor Data: 12|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField - Name: <Name>k__BackingField
Entry: 1 Entry: 1
Data: _ghost Data: _lastUpdate
- Name: <UserType>k__BackingField - Name: <UserType>k__BackingField
Entry: 7 Entry: 7
Data: 13|System.RuntimeType, mscorlib Data: 13|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: Marro.PacManUdon.Ghost, Assembly-CSharp
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 9
Data: 4
- 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: 14|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: _lastUpdate
- Name: $v
Entry: 7
Data: 15|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: _lastUpdate
- Name: <UserType>k__BackingField
Entry: 7
Data: 16|System.RuntimeType, mscorlib
- Name: - Name:
Entry: 1 Entry: 1
Data: Marro.PacManUdon.PoleStrechLevels, Assembly-CSharp Data: Marro.PacManUdon.PoleStrechLevels, Assembly-CSharp
@@ -289,7 +235,7 @@ MonoBehaviour:
Data: Data:
- Name: <SystemType>k__BackingField - Name: <SystemType>k__BackingField
Entry: 7 Entry: 7
Data: 17|System.RuntimeType, mscorlib Data: 14|System.RuntimeType, mscorlib
- Name: - Name:
Entry: 1 Entry: 1
Data: System.Int32, mscorlib Data: System.Int32, mscorlib
@@ -310,7 +256,7 @@ MonoBehaviour:
Data: false Data: false
- Name: _fieldAttributes - Name: _fieldAttributes
Entry: 7 Entry: 7
Data: 18|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib Data: 15|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name: - Name:
Entry: 12 Entry: 12
Data: 0 Data: 0

View File

@@ -2,7 +2,6 @@
using UnityEngine; using UnityEngine;
using VRC.SDKBase; using VRC.SDKBase;
using VRC.Udon; using VRC.Udon;
using static Cinemachine.DocumentationSortingAttribute;
namespace Marro.PacManUdon namespace Marro.PacManUdon
{ {
@@ -16,7 +15,7 @@ namespace Marro.PacManUdon
} }
[RequireComponent(typeof(Animator))] [RequireComponent(typeof(Animator))]
public class Intermission2Pole : SyncedObject public class Intermission2Pole : UdonSharpBehaviour
{ {
Animator _animator; Animator _animator;
@@ -35,7 +34,6 @@ namespace Marro.PacManUdon
_ghost = ghost; _ghost = ghost;
_gameManager = gameManager; _gameManager = gameManager;
_animator = GetComponent<Animator>(); _animator = GetComponent<Animator>();
SetActive(false); // Should only activate for intermission 2
Reset(); Reset();
} }
@@ -45,13 +43,7 @@ namespace Marro.PacManUdon
SetStrechLevel(PoleStrechLevels.None); SetStrechLevel(PoleStrechLevels.None);
} }
public void SetActive(bool isActive) public void FixedUpdate()
{
Debug.Log($"({nameof(PacManUdon)} {nameof(Intermission2Pole)}) SetActive {isActive}.");
gameObject.SetActive(isActive);
}
public override void SyncedUpdate()
{ {
if (!_ghost.gameObject.activeInHierarchy) if (!_ghost.gameObject.activeInHierarchy)
{ {
@@ -115,7 +107,6 @@ namespace Marro.PacManUdon
public void SetStrechLevel(PoleStrechLevels level) public void SetStrechLevel(PoleStrechLevels level)
{ {
Debug.Log($"({nameof(PacManUdon)} {nameof(Intermission2Pole)}) Set strech level to {level}.");
_animator.SetFloat("Strech", GetAnimatorValueForStrechLevel(level)); _animator.SetFloat("Strech", GetAnimatorValueForStrechLevel(level));
} }
@@ -143,15 +134,5 @@ namespace Marro.PacManUdon
{ {
return (Vector2)transform.localPosition; return (Vector2)transform.localPosition;
} }
public override void CollectSyncedData(byte[] data, ref int index, NetworkEventType eventType)
{
}
public override bool WriteSyncedData(byte[] data, ref int index, NetworkEventType eventType)
{
return true;
}
} }
} }

View File

@@ -43,7 +43,7 @@ MonoBehaviour:
Data: Data:
- Name: - Name:
Entry: 12 Entry: 12
Data: 6 Data: 4
- Name: - Name:
Entry: 7 Entry: 7
Data: Data:
@@ -109,19 +109,19 @@ MonoBehaviour:
Data: Data:
- Name: $k - Name: $k
Entry: 1 Entry: 1
Data: pelletContainer Data: ghostTargets
- Name: $v - Name: $v
Entry: 7 Entry: 7
Data: 6|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor Data: 6|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField - Name: <Name>k__BackingField
Entry: 1 Entry: 1
Data: pelletContainer Data: ghostTargets
- Name: <UserType>k__BackingField - Name: <UserType>k__BackingField
Entry: 7 Entry: 7
Data: 7|System.RuntimeType, mscorlib Data: 7|System.RuntimeType, mscorlib
- Name: - Name:
Entry: 1 Entry: 1
Data: UnityEngine.GameObject, UnityEngine.CoreModule Data: UnityEngine.GameObject[], UnityEngine.CoreModule
- Name: - Name:
Entry: 8 Entry: 8
Data: Data:
@@ -169,19 +169,25 @@ MonoBehaviour:
Data: Data:
- Name: $k - Name: $k
Entry: 1 Entry: 1
Data: mazeSprite Data: pelletContainer
- Name: $v - Name: $v
Entry: 7 Entry: 7
Data: 10|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor Data: 10|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField - Name: <Name>k__BackingField
Entry: 1 Entry: 1
Data: mazeSprite Data: pelletContainer
- Name: <UserType>k__BackingField - Name: <UserType>k__BackingField
Entry: 9 Entry: 7
Data: 7 Data: 11|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: UnityEngine.GameObject, UnityEngine.CoreModule
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField - Name: <SystemType>k__BackingField
Entry: 9 Entry: 9
Data: 7 Data: 11
- Name: <SyncMode>k__BackingField - Name: <SyncMode>k__BackingField
Entry: 7 Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -196,13 +202,13 @@ MonoBehaviour:
Data: true Data: true
- Name: _fieldAttributes - Name: _fieldAttributes
Entry: 7 Entry: 7
Data: 11|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib Data: 12|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name: - Name:
Entry: 12 Entry: 12
Data: 1 Data: 1
- Name: - Name:
Entry: 7 Entry: 7
Data: 12|UnityEngine.SerializeField, UnityEngine.CoreModule Data: 13|UnityEngine.SerializeField, UnityEngine.CoreModule
- Name: - Name:
Entry: 8 Entry: 8
Data: Data:
@@ -223,25 +229,19 @@ MonoBehaviour:
Data: Data:
- Name: $k - Name: $k
Entry: 1 Entry: 1
Data: ghostTargets Data: mazeSprite
- Name: $v - Name: $v
Entry: 7 Entry: 7
Data: 13|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor Data: 14|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField - Name: <Name>k__BackingField
Entry: 1 Entry: 1
Data: ghostTargets Data: mazeSprite
- Name: <UserType>k__BackingField - Name: <UserType>k__BackingField
Entry: 7 Entry: 9
Data: 14|System.RuntimeType, mscorlib Data: 11
- Name:
Entry: 1
Data: UnityEngine.Transform[], UnityEngine.CoreModule
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField - Name: <SystemType>k__BackingField
Entry: 9 Entry: 9
Data: 14 Data: 11
- Name: <SyncMode>k__BackingField - Name: <SyncMode>k__BackingField
Entry: 7 Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -278,120 +278,6 @@ MonoBehaviour:
- Name: - Name:
Entry: 8 Entry: 8
Data: Data:
- Name:
Entry: 7
Data:
- Name: $k
Entry: 1
Data: ghostStarts
- Name: $v
Entry: 7
Data: 17|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: ghostStarts
- Name: <UserType>k__BackingField
Entry: 9
Data: 14
- Name: <SystemType>k__BackingField
Entry: 9
Data: 14
- 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: 18|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 1
- Name:
Entry: 7
Data: 19|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: 7
Data:
- Name: $k
Entry: 1
Data: pacManStart
- Name: $v
Entry: 7
Data: 20|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: pacManStart
- Name: <UserType>k__BackingField
Entry: 7
Data: 21|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: UnityEngine.Transform, UnityEngine.CoreModule
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 9
Data: 21
- 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: 22|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 1
- Name:
Entry: 7
Data: 23|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: - Name:
Entry: 13 Entry: 13
Data: Data:

View File

@@ -1,15 +1,15 @@
using UdonSharp; namespace Marro.PacManUdon
using UnityEngine;
namespace Marro.PacManUdon
{ {
using UdonSharp;
using UnityEngine;
using VRC.SDKBase;
using VRC.Udon;
public class Maze : UdonSharpBehaviour public class Maze : UdonSharpBehaviour
{ {
[SerializeField] public Vector2 mazeBoundaries; [SerializeField] public Vector2 mazeBoundaries;
[SerializeField] public GameObject[] ghostTargets;
[SerializeField] public GameObject pelletContainer; [SerializeField] public GameObject pelletContainer;
[SerializeField] public GameObject mazeSprite; [SerializeField] public GameObject mazeSprite;
[SerializeField] public Transform[] ghostTargets;
[SerializeField] public Transform[] ghostStarts;
[SerializeField] public Transform pacManStart;
} }
} }

File diff suppressed because it is too large Load Diff

View File

@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: a327a0e472dbf694a8e2b23bf0ce90d0
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,984 +0,0 @@
using System;
using System.Text;
using TMPro;
using UdonSharp;
using UnityEngine;
using VRC.SDK3.UdonNetworkCalling;
using VRC.SDKBase;
using VRC.Udon.Common;
namespace Marro.PacManUdon
{
public enum NetworkEventType
{
FullSyncForced = 0,
FullSync = 1,
PacManTurn = 2,
StartGameButtonPressed = 3,
SyncPellets = 4,
GhostUpdate = 5,
}
public class NetworkManager : UdonSharpBehaviour
{
// The network manager works by serializing event and state data into a byte array, including a timestamp for each event.
// If user is owner, this data is created and stored in a buffer which is cleared upon transmission.
// If user is not owner, this data is read into the same buffer and replayed based on the included timestamp.
// Data replay is delayed with an offset on the timestamp to hide inconsistency in latency.
// Each event contains a header. The first part contains the size of the event as a ushort, allowing a maximum size of 65,536 bytes.
// After that timestamp is transferred in seconds since the owner started the game as a float, matching Unity's time representation.
// Afterwards is a message id, a single byte which increments (with overflow) for every event to confirm data completeness.
// Lastly, a single byte indicates the type of event. 0 is a full sync, which is reserved for syncing up from any unknown state.
// A byte array is used as a DataList or DataDictionary can only be transmitted as JSON which is much less efficient.
// As Udon does not support instantiating objects, I have not created classes to represent the data being sent.
// Correct parsing is dependend upon everything being read out identially to how it was created.
// An event has the following structure:
// [0-1]: (ushort) Size of event.
// [2-5]: (float) Time in seconds at which event occured.
// [6]: (byte) Message id, increments by one for each message with the same timestamp.
// [7]: (byte) Type of event. 0 = Full Sync, which is used to sync up from an undefinted state.
// [+]: Event-specific data.
#region Settings
/// <summary>
/// The root from which this <see cref="NetworkManager"/> will look for <see cref="SyncedObject"/> to control.
/// </summary>
[SerializeField] private GameObject root;
/// <summary>
/// The delay at which the receiving side replays events.
/// </summary>
[SerializeField] private float delay = 1f;
/// <summary>
/// The maximum amount of times a message is sent.
/// </summary>
[SerializeField] private int maxEventSendTries = 3;
/// <summary>
/// How long to wait since last message to send next ping.
/// </summary>
[SerializeField] private float pingDelay = 0.3f;
/// <summary>
/// The rate at which updates occur.
/// </summary>
[SerializeField] private float updateRate = 0.0166666667f;
#endregion
#region Constants
/// <summary>
/// The maximum amount of events in the buffer.
/// </summary>
private const int BufferMaxTotalEvents = 255;
/// <summary>
/// The maximum amount of events in the buffer.
/// </summary>
private const int MaxEventSize = ushort.MaxValue;
/// <summary>
/// The index in an event where the event size is stored.
/// </summary>
private const ushort HeaderEventSizeIndex = 0;
/// <summary>
/// The index in an event where the timestamp is stored.
/// </summary>
private const ushort HeaderTimestampIndex = 2;
/// <summary>
/// The index in an event where the event id is stored.
/// </summary>
private const ushort HeaderEventIdIndex = 6;
/// <summary>
/// The index in an event where the event type is stored.
/// </summary>
private const ushort HeaderEventTypeIndex = 7;
/// <summary>
/// The total length of the header of an event, in bytes.
/// </summary>
private const ushort HeaderLength = 8;
#endregion
#region Private attributes
/// <summary>
/// Objects which are controlled by this <see cref="NetworkManager"/>.
/// </summary>
private SyncedObject[] syncedObjects;
/// <summary>
/// Offset from system time to network time, including delay.
/// </summary>
private float offsetTime;
/// <summary>
/// Time since last full sync, captured when this FixedUpdate started, with network delay applied.
/// </summary>
private float internalTime;
/// <summary>
/// Time at which the latest update occured
/// </summary>
private float nextUpdateTime;
/// <summary>
/// Time at which next received event occured.
/// </summary>
private float nextEventTime;
/// <summary>
/// Amounot of retries in a row without a successful sync.
/// </summary>
private int retriesWithoutSuccess;
/// <summary>
/// For receiver: True if there's a full sync in the queue and we are not synced, otherwise false.
/// For transmitter: True if there's a full sync in the queue which has not yet been transmitted, otherwise false.
/// </summary>
private bool hasFullSyncReady;
/// <summary>
/// True if serialization has been requestsed
/// </summary>
private bool serializationRequested;
/// <summary>
/// Events to send at the end of SyncedUpdate cycle
/// </summary>
private NetworkEventType[] eventsToSend;
/// <summary>
/// Index for <see cref="eventsToSend"/>
/// </summary>
private int eventsToSendIndex;
/// <summary>
/// Queue of events to be transmitted or processed.
/// </summary>
private byte[][] eventsQueue;
/// <summary>
/// Index of <see cref="eventsQueue"/>.
/// </summary>
private int eventsQueueIndex;
/// <summary>
/// The value of <see cref="eventsQueueIndex"/> at the last transmission.
/// </summary>
private int eventsQueueIndexAtLastTransmission;
/// <summary>
/// Counts of new events at recent transmissions.
/// </summary>
private int[] eventTransmissionHistory;
/// <summary>
/// Index of <see cref="eventTransmissionHistoryIndex"/>.
/// </summary>
private int eventTransmissionHistoryIndex;
/// <summary>
/// Time of last event transmission.
/// </summary>
private float lastEventTransmissionTime;
/// <summary>
/// The message id of the most recent event created or received.
/// </summary>
private byte lastEventId;
/// <summary>
/// Data which is currently available on the network.
/// </summary>
[UdonSynced] private byte[] networkedData = new byte[0];
#endregion
#region Public fields
/// <summary>
/// Whether this <see cref="NetworkManager"/> is ready to transmit or receive data.
/// If false, networking is disabled and this <see cref="NetworkManager"/> acts as a pass-through.
/// </summary>
public bool Ready { get; private set; } = false;
/// <summary>
/// Whether the current perspective is synced with the owner. (Always true if current perspective is owner.)
/// </summary>
public bool Synced { get; private set; } = false;
/// <summary>
/// The time since last full sync which is currently being simulated.
/// </summary>
public float SyncedTime { get; private set; }
/// <summary>
/// Time since the last simulation, in seconds.
/// </summary>
public float SyncedDeltaTime { get; private set; }
/// <summary>
/// Is the current simulation to prepare for applying a network event?
/// True = Yes, This update is preparing for a network update.
/// False = No, this update is after the network update or there was no network update this cycle.
/// </summary>
public bool IsEventUpdate { get; private set; }
/// <summary>
/// Is the local user owner?
/// </summary>
public bool IsOwner { get; private set; }
#endregion
#region General
public void Initialize()
{
if (!BitConverter.IsLittleEndian)
{
Debug.LogError($"({nameof(PacManUdon)} {nameof(NetworkManager)}) Fatal: NetworkManager only supports little endian! Network sync will not be possible.");
Ready = false;
return;
}
if (root == null)
{
root = transform.parent.gameObject;
}
syncedObjects = root.GetComponentsInChildren<SyncedObject>(includeInactive: true);
foreach (var obj in syncedObjects)
{
obj.networkManager = this;
}
Debug.Log($"({nameof(PacManUdon)} {nameof(NetworkManager)}) Found {syncedObjects.Length} {nameof(SyncedObject)} in children of {root.name}.");
SetOwner(Networking.IsOwner(gameObject));
ClearBuffer();
Synced = IsOwner; // Owner is always synced
retriesWithoutSuccess = 0;
hasFullSyncReady = false;
offsetTime = Time.fixedTime;
internalTime = 0;
SyncedTime = 0;
SyncedDeltaTime = Time.fixedDeltaTime;
nextUpdateTime = SyncedTime;
if (!Synced)
{
RequestEvent(NetworkEventType.FullSync); // See if we can sync up
}
Ready = true;
Debug.Log($"({nameof(PacManUdon)} {nameof(NetworkManager)}) Initialized, time offset: {offsetTime}");
}
public void Update()
{
if (!Ready)
{
return;
}
// Fetch the current time
UpdateInternalTime();
if (Ready)
{
if (IsOwner)
{
ProcessEventsToSend(); // Prepare events from last cycle
ProgressPingTime(); // See if we need to send a ping
}
else
{
ApplyReceivedEvents(); // See if there's events that need to be replayed
}
}
// Forwards simulated time at the updateRate pace
while (nextUpdateTime <= internalTime)
{
ProgressSyncedTime(nextUpdateTime);
PerformFixedSyncedUpdate();
nextUpdateTime = SyncedTime + updateRate;
}
}
private void UpdateInternalTime()
{
internalTime = Time.fixedTime - offsetTime;
}
private void PerformFixedSyncedUpdate()
{
IsEventUpdate = false;
for (int i = 0; i < syncedObjects.Length; i++)
{
var obj = syncedObjects[i];
if (obj.gameObject.activeInHierarchy)
{
obj.SyncedUpdate();
}
}
}
private void HandleError(bool clearBuffer)
{
retriesWithoutSuccess++;
if (retriesWithoutSuccess > 3)
{
Debug.LogError($"({nameof(PacManUdon)} {nameof(NetworkManager)}) Fatal: Retried 3 times without success.");
Ready = false;
return;
}
Debug.LogWarning($"({nameof(PacManUdon)} {nameof(NetworkManager)}) Encountered data error, attempting to recover via full sync.");
if (clearBuffer)
{
ClearBuffer();
}
Synced = false;
if (!IsOwner)
{
RequestEvent(NetworkEventType.FullSync);
}
else
{
SendEventSoon(NetworkEventType.FullSyncForced);
}
}
private void SetOwner(bool isOwner)
{
IsOwner = isOwner;
if (DebugImageToIndicateOwner != null)
{
DebugImageToIndicateOwner.SetFloat("Color", isOwner ? 1 : 0);
}
}
#endregion
#region Sender
public void SendEventSoon(NetworkEventType eventType)
{
if (!Ready)
{
return;
}
if (!IsOwner)
{
Debug.LogWarning($"({nameof(PacManUdon)} {nameof(NetworkManager)}) Attempted {nameof(SendEventSoon)} while not the owner!");
return;
}
if (eventsQueueIndex > eventsToSend.Length)
{
Debug.LogWarning($"({nameof(PacManUdon)} {nameof(NetworkManager)}) {nameof(eventsToSend)} overflow!");
HandleError(false);
return;
}
eventsToSend[eventsToSendIndex++] = eventType;
}
private void ProcessEventsToSend()
{
for (int i = 0; i < eventsToSendIndex; i++)
{
SendEventNow(eventsToSend[0]);
}
eventsToSendIndex = 0;
}
public void SendEventNow(NetworkEventType eventType)
{
if (!Ready)
{
return;
}
if (!IsOwner)
{
Debug.LogWarning($"({nameof(PacManUdon)} {nameof(NetworkManager)}) Attempted {nameof(SendEventNow)} while not the owner!");
return;
}
var timestamp = SyncedTime;
var eventId = GetNextEventId(lastEventId);
InitializeEvent(eventType, timestamp, eventId, out byte[] data, out var index);
foreach (var obj in syncedObjects)
{
obj.CollectSyncedData(data, ref index, eventType);
}
// Validate and fill in event size
var eventSizeBytes = BitConverter.GetBytes((ushort)index);
Array.Copy(eventSizeBytes, 0, data, HeaderEventSizeIndex, eventSizeBytes.Length);
if (IsFullSync(eventType))
{
hasFullSyncReady = true;
}
data = GetArrayPart(data, 0, index);
QueueEventInBuffer(data);
Debug.Log($"({nameof(PacManUdon)} {nameof(NetworkManager)}) Prepared event of type {eventType} with {data.Length} bytes, timestamp {timestamp} and id {eventId} for serialization.");
RequestSerializationForEvents();
lastEventId = eventId;
retriesWithoutSuccess = 0; // We had success!
}
private static void InitializeEvent(NetworkEventType eventType, float timestamp, byte eventId, out byte[] data, out int index)
{
data = new byte[MaxEventSize];
// Create header (note: event size is added later)
var timestampBytes = BitConverter.GetBytes(timestamp);
Array.Copy(timestampBytes, 0, data, HeaderTimestampIndex, timestampBytes.Length);
data[HeaderEventIdIndex] = eventId;
data[HeaderEventTypeIndex] = ((int)eventType).ToByte();
index = HeaderLength;
}
private void RequestSerializationForEvents()
{
RequestSerialization();
serializationRequested = true;
}
[NetworkCallable]
public void RequestEventReceived(NetworkEventType eventType)
{
if (!Ready)
{
return;
}
if (IsFullSync(eventType) && hasFullSyncReady)
{
return; // Don't send another full sync if we're already preparing to send one
}
if (eventType == NetworkEventType.FullSyncForced)
{
SendEventSoon(NetworkEventType.FullSync); // Remote is not allowed to request a forced full sync
return;
}
SendEventSoon(eventType);
}
private void ProgressPingTime()
{
if (eventsQueueIndex > 0
&& internalTime - lastEventTransmissionTime >= pingDelay)
{
RequestSerializationForEvents();
}
}
public override void OnPreSerialization()
{
if (!Ready || !IsOwner || !serializationRequested || eventsQueue == null || eventsQueueIndex == 0)
{
return;
}
networkedData = Flatten(eventsQueue, 0, eventsQueueIndex);
eventTransmissionHistory[eventTransmissionHistoryIndex] = eventsQueueIndex - eventsQueueIndexAtLastTransmission;
eventTransmissionHistoryIndex += 1;
if (eventTransmissionHistoryIndex >= eventTransmissionHistory.Length)
{
eventTransmissionHistoryIndex = 0;
}
serializationRequested = false;
Debug.Log($"({nameof(PacManUdon)} {nameof(NetworkManager)}) Serializing {eventsQueueIndex} event(s), eventTransmissionHistory is now {ArrayToString(eventTransmissionHistory)} with index {eventTransmissionHistoryIndex}");
}
public override void OnPostSerialization(SerializationResult result)
{
if (!Ready || !IsOwner || networkedData.Length == 0)
{
return;
}
if (!result.success)
{
Debug.LogWarning($"({nameof(PacManUdon)} {nameof(NetworkManager)}) Serialization failed! Tried to send {result.byteCount} bytes.");
return;
}
Debug.Log($"({nameof(PacManUdon)} {nameof(NetworkManager)}) Serialized with {networkedData.Length} bytes.\nBytes sent:\n{ArrayToString(networkedData)}");
// Remove data from the buffer that no longer needs to be (re)transmitted
DequeueEventsFromBuffer(eventTransmissionHistory[eventTransmissionHistoryIndex]);
eventTransmissionHistory[eventTransmissionHistoryIndex] = 0; // Prevent trying to remove the same events again
eventsQueueIndexAtLastTransmission = eventsQueueIndex;
networkedData = new byte[0];
// If there was a full sync in the queue, it has now been transmitted at least once
hasFullSyncReady = false;
lastEventTransmissionTime = internalTime;
}
#endregion
#region Receiver
public void RequestEvent(NetworkEventType eventType)
{
if (!Ready)
{
return;
}
if (IsOwner)
{
Debug.LogError($"({nameof(PacManUdon)} {nameof(NetworkManager)}) Attempted {nameof(RequestEvent)} while we are the owner!");
return;
}
SendCustomNetworkEvent(VRC.Udon.Common.Interfaces.NetworkEventTarget.Owner, "RequestEventReceived", eventType);
}
private void StoreIncomingData()
{
if (networkedData == null || networkedData.Length == 0)
{
return; // Nothing to store
}
Debug.Log($"({nameof(PacManUdon)} {nameof(NetworkManager)}) Received {networkedData.Length} bytes!\nBytes received:\n{ArrayToString(networkedData)}");
var length = networkedData.Length;
int index = 0;
int eventSize = 0; // Store event size here so we can increment the index no matter how we increment the loop
while ((index += eventSize) < length)
{
if (length - index < HeaderLength)
{
Debug.LogWarning($"({nameof(PacManUdon)} {nameof(NetworkManager)}) {nameof(StoreIncomingData)}: Remaining data in networkedData is not long enough to form a complete event! remaining: {length - index}.");
HandleError(false);
return;
}
eventSize = GetEventSizeFromHeader(networkedData, index);
if (length - index < eventSize)
{
Debug.LogWarning($"({nameof(PacManUdon)} {nameof(NetworkManager)}) {nameof(StoreIncomingData)}: Event size is larger than total remaining data! {nameof(eventSize)}: {eventSize}, remaining: {length - index}.");
HandleError(false);
return;
}
if (length - index < HeaderLength)
{
Debug.LogWarning($"({nameof(PacManUdon)} {nameof(NetworkManager)}) {nameof(StoreIncomingData)}: Event size is not long enough to form a complete event! {nameof(eventSize)}: {eventSize}, minimum needed: {HeaderLength}.");
HandleError(false);
return;
}
var @event = GetArrayPart(networkedData, index, eventSize);
var timestamp = GetTimestampFromHeader(@event);
var eventId = GetEventIdFromHeader(@event);
var eventType = GetEventTypeFromHeader(@event);
if (eventType != NetworkEventType.FullSyncForced && (Synced || hasFullSyncReady))
{
// Check if event id is sequential
if (eventId != GetNextEventId(lastEventId))
{
if (index + eventSize >= length // If this is the last event of the batch
&& eventId != lastEventId) // Unless the eventId is the same, then this is probably just a duplicate
{
// The last event of the batch has to be synced up with our current event id count, else we've missed an event
Debug.LogWarning($"({nameof(PacManUdon)} {nameof(NetworkManager)}) EventIds were not sequential! Did we miss an event? Timestamp: {timestamp}, eventId: {eventId}, lastEventId: {lastEventId}.");
HandleError(false);
return;
}
// We've likely already processed this event, ignore it
continue;
}
QueueEventInBuffer(@event);
Debug.LogWarning($"({nameof(PacManUdon)} {nameof(NetworkManager)} Queued event with id {eventId}");
}
else
{
// If we're not yet synced, we only care about full sync events.
if (IsFullSync(eventType))
{
QueueFullSyncForReplay(@event); // Immediately process full sync
}
}
lastEventId = eventId;
}
if (Synced)
{
UpdateNextEventTime();
}
}
private void QueueFullSyncForReplay(byte[] @event)
{
// Clear buffer and put the full sync into it
ClearBuffer();
QueueEventInBuffer(@event);
// Set this event to play after the default delay
nextEventTime = internalTime + delay;
hasFullSyncReady = true;
Debug.Log($"({nameof(PacManUdon)} {nameof(NetworkManager)}) Queued full sync in buffer, should execute at {nextEventTime}.");
}
private void ApplyReceivedEvents()
{
IsEventUpdate = true;
while (eventsQueueIndex > 0 && nextEventTime <= internalTime)
{
var success = ApplyEvent(eventsQueue[0]);
if (!success)
{
return;
}
DequeueEventsFromBuffer(1);
UpdateNextEventTime();
}
}
private bool ApplyEvent(byte[] @event)
{
var timestamp = GetTimestampFromHeader(@event);
var eventType = GetEventTypeFromHeader(@event);
var isFullSync = IsFullSync(eventType);
if (!Synced || eventType == NetworkEventType.FullSyncForced)
{
SyncToTimestamp(timestamp);
}
var index = (int)HeaderLength; // Skip header
ProgressSyncedTime(timestamp);
foreach (var obj in syncedObjects)
{
obj.SyncedUpdate();
}
foreach (var obj in syncedObjects)
{
var success = obj.WriteSyncedData(@event, ref index, eventType);
if (!success)
{
Debug.LogWarning($"({nameof(PacManUdon)} {nameof(NetworkManager)}) Malformed data reported by {obj.name} during event type {eventType}!");
HandleError(true);
return false;
}
}
var eventSize = GetEventSizeFromHeader(@event);
if (index != eventSize)
{
Debug.LogWarning($"({nameof(PacManUdon)} {nameof(NetworkManager)}) Amount of data read does not match event size! Expected {eventSize}, read {index}.");
HandleError(true);
return false;
}
if (!Synced && isFullSync)
{
hasFullSyncReady = false;
Synced = true;
}
Debug.Log($"({nameof(PacManUdon)} {nameof(NetworkManager)}) Performed incoming eventof type {eventType}! Total {index} bytes.");
retriesWithoutSuccess = 0; // We had success!
return true;
}
public override void OnDeserialization()
{
if (!Ready || IsOwner)
{
return;
}
StoreIncomingData();
}
#endregion
#region Buffer
private void ClearBuffer()
{
eventsQueue = new byte[BufferMaxTotalEvents][];
eventsQueueIndex = 0;
lastEventId = 0;
hasFullSyncReady = false;
eventTransmissionHistory = new int[maxEventSendTries];
eventTransmissionHistoryIndex = 0;
eventsQueueIndexAtLastTransmission = 0;
eventsToSend = new NetworkEventType[BufferMaxTotalEvents];
eventsToSendIndex = 0;
}
private void DequeueEventsFromBuffer(int eventCount)
{
if (eventCount > eventsQueueIndex) // Never remove more events than are in the queue
{
eventCount = eventsQueueIndex;
}
var oldBuffer = eventsQueue;
eventsQueueIndex -= eventCount;
eventsQueue = new byte[BufferMaxTotalEvents][];
Array.Copy(oldBuffer, eventCount, eventsQueue, 0, eventsQueueIndex);
}
private bool QueueEventInBuffer(byte[] @event)
{
if (eventsQueueIndex >= BufferMaxTotalEvents)
{
Debug.LogWarning($"({nameof(PacManUdon)} {nameof(NetworkManager)}) Buffer not large enough to store event! Maximum event count: {BufferMaxTotalEvents}.");
HandleError(true);
return false;
}
eventsQueue[eventsQueueIndex++] = @event;
return true;
}
#endregion
#region Time
private void ProgressSyncedTime(float newTime)
{
//Debug.Log($"({nameof(PacManUdon)} {nameof(NetworkManager)}) updating SyncedTime from {SyncedTime} to {newTime}");
SyncedDeltaTime = newTime - SyncedTime;
if (SyncedDeltaTime < 0)
{
Debug.LogWarning($"({nameof(PacManUdon)} {nameof(NetworkManager)}) Negative Dt: {SyncedDeltaTime}! Going from {SyncedTime} to {newTime}, IsEventUpdate: {IsEventUpdate}");
}
SyncedTime = newTime;
}
private void SyncToTimestamp(float timestamp)
{
var oldOffset = offsetTime;
offsetTime = Time.fixedTime - timestamp;
var delta = offsetTime - oldOffset;
internalTime -= delta;
SyncedTime -= delta;
nextEventTime -= delta;
Debug.Log($"({nameof(PacManUdon)} {nameof(NetworkManager)}) Synced to timestamp {timestamp}, current time is {Time.fixedTime}, offsetTime is now {offsetTime}, internalTime is now {internalTime}, SyncedTime is now {SyncedTime}, nextEventTime is now {nextEventTime}");
}
private void UpdateNextEventTime()
{
if (eventsQueueIndex == 0)
{
return;
}
var nextEventTime = GetTimestampFromHeader(eventsQueue[0]);
if (nextEventTime < this.nextEventTime)
{
Debug.LogWarning($"({nameof(PacManUdon)} {nameof(NetworkManager)}) New event is earlier than previous event!");
HandleError(true);
return;
}
if (nextEventTime < SyncedTime)
{
Debug.LogWarning($"({nameof(PacManUdon)} {nameof(NetworkManager)}) New event timestamp is earlier than our current synced time by {SyncedTime - nextEventTime} seconds! nextEventTime: {nextEventTime} SyncedTime: {SyncedTime}, internalTime: {internalTime}");
HandleError(true);
return;
}
this.nextEventTime = nextEventTime;
}
#endregion
#region Header
private static byte GetNextEventId(byte currentEventId)
{
if (currentEventId == byte.MaxValue) // Udon forces overflow checks
{
return 0;
}
currentEventId += 1;
return currentEventId;
}
private static bool IsFullSync(NetworkEventType eventType)
=> eventType == NetworkEventType.FullSync || eventType == NetworkEventType.FullSyncForced;
private static ushort GetEventSizeFromHeader(byte[] @event, int eventIndex = 0)
=> BitConverter.ToUInt16(@event, eventIndex + HeaderEventSizeIndex);
private static NetworkEventType GetEventTypeFromHeader(byte[] @event, int eventIndex = 0) =>
(NetworkEventType)@event[eventIndex + HeaderEventTypeIndex];
private static float GetTimestampFromHeader(byte[] @event, int eventIndex = 0) =>
BitConverter.ToSingle(@event, eventIndex + HeaderTimestampIndex);
private static byte GetEventIdFromHeader(byte[] @event, int eventIndex = 0) =>
@event[eventIndex + HeaderEventIdIndex];
#endregion
#region VRC events
public override void OnOwnershipTransferred(VRCPlayerApi newOwner)
{
if (!Ready)
{
return;
}
bool newOwnerIsLocalPlayer = newOwner == Networking.LocalPlayer;
SetOwner(newOwnerIsLocalPlayer);
if (newOwnerIsLocalPlayer)
{
SendEventSoon(NetworkEventType.FullSyncForced);
}
}
#endregion
#region Utils
public string ArrayToString(byte[] bytes)
{
var sb = new StringBuilder("[ ");
foreach (var b in bytes)
{
sb.Append(b + " ");
}
sb.Append("]");
return sb.ToString();
}
public string ArrayToString(int[] bytes)
{
var sb = new StringBuilder("[ ");
foreach (var b in bytes)
{
sb.Append(b + " ");
}
sb.Append("]");
return sb.ToString();
}
private static int GetFlattenedSize(byte[][] data, int start, int length)
{
var size = 0;
for (int i = start; i < start + length; i++)
{
size += data[i].Length;
}
return size;
}
private static byte[] Flatten(byte[][] data, int start, int length)
{
var finalLength = GetFlattenedSize(data, start, length);
var result = new byte[finalLength];
int resultIndex = 0;
for (int sourceIndex = start; sourceIndex < start + length; sourceIndex++)
{
var array = data[sourceIndex];
Array.Copy(array, 0, result, resultIndex, array.Length);
resultIndex += array.Length;
}
return result;
}
private static byte[] GetArrayPart(byte[] data, int start, int length)
{
var result = new byte[length];
Array.Copy(data, start, result, 0, length);
return result;
}
#endregion
#region Debug
public void SimulateSyncToTimestamp(float timestamp)
{
SyncToTimestamp(timestamp);
}
public void WriteDebugOutput(TMP_InputField debugOutput)
{
debugOutput.text += $"{nameof(NetworkManager)}:\n" +
$"IsOwner: {IsOwner}\n" +
$"Ready: {Ready}\n" +
$"Synced: {Synced}\n" +
$"hasFullSyncReady: {hasFullSyncReady}\n" +
$"lastEventId: {lastEventId}" +
$"Time.fixedTime: {Time.fixedTime}\n" +
$"offsetTime: {offsetTime}\n" +
$"internalTime: {internalTime}\n" +
$"SyncedTime: {SyncedTime}\n" +
$"Dt: {SyncedDeltaTime}\n" +
$"BufferIndex: {eventsQueueIndex}\n" +
$"BufferIndexHistory: {ArrayToString(eventTransmissionHistory)}\n" +
$"\n";
}
/// <summary>
/// An animator which visualizes whether the current perspective is the owner.
/// </summary>
[SerializeField] private Animator DebugImageToIndicateOwner;
public void DoFullSync()
{
SendEventSoon(NetworkEventType.FullSync);
}
public void DoPelletSync()
{
SendEventSoon(NetworkEventType.SyncPellets);
}
public void DoGhostSync()
{
SendEventSoon(NetworkEventType.GhostUpdate);
}
#endregion
}
}

View File

@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: ac984c07ae3e9674a850c3916be56ca3
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -43,25 +43,25 @@ MonoBehaviour:
Data: Data:
- Name: - Name:
Entry: 12 Entry: 12
Data: 20 Data: 22
- Name: - Name:
Entry: 7 Entry: 7
Data: Data:
- Name: $k - Name: $k
Entry: 1 Entry: 1
Data: networkManager Data: gameController
- Name: $v - Name: $v
Entry: 7 Entry: 7
Data: 2|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor Data: 2|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField - Name: <Name>k__BackingField
Entry: 1 Entry: 1
Data: networkManager Data: gameController
- Name: <UserType>k__BackingField - Name: <UserType>k__BackingField
Entry: 7 Entry: 7
Data: 3|System.RuntimeType, mscorlib Data: 3|System.RuntimeType, mscorlib
- Name: - Name:
Entry: 1 Entry: 1
Data: Marro.PacManUdon.NetworkManager, Assembly-CSharp Data: Marro.PacManUdon.GameManager, Assembly-CSharp
- Name: - Name:
Entry: 8 Entry: 8
Data: Data:
@@ -85,7 +85,7 @@ MonoBehaviour:
Data: Data:
- Name: <IsSerialized>k__BackingField - Name: <IsSerialized>k__BackingField
Entry: 5 Entry: 5
Data: true Data: false
- Name: _fieldAttributes - Name: _fieldAttributes
Entry: 7 Entry: 7
Data: 5|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib Data: 5|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
@@ -109,25 +109,25 @@ MonoBehaviour:
Data: Data:
- Name: $k - Name: $k
Entry: 1 Entry: 1
Data: direction Data: input
- Name: $v - Name: $v
Entry: 7 Entry: 7
Data: 6|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor Data: 6|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField - Name: <Name>k__BackingField
Entry: 1 Entry: 1
Data: direction Data: input
- Name: <UserType>k__BackingField - Name: <UserType>k__BackingField
Entry: 7 Entry: 7
Data: 7|System.RuntimeType, mscorlib Data: 7|System.RuntimeType, mscorlib
- Name: - Name:
Entry: 1 Entry: 1
Data: UnityEngine.Vector2, UnityEngine.CoreModule Data: Marro.PacManUdon.PlayerInput, Assembly-CSharp
- Name: - Name:
Entry: 8 Entry: 8
Data: Data:
- Name: <SystemType>k__BackingField - Name: <SystemType>k__BackingField
Entry: 9 Entry: 9
Data: 7 Data: 4
- Name: <SyncMode>k__BackingField - Name: <SyncMode>k__BackingField
Entry: 7 Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -163,25 +163,25 @@ MonoBehaviour:
Data: Data:
- Name: $k - Name: $k
Entry: 1 Entry: 1
Data: gameController Data: defaultSpeed
- Name: $v - Name: $v
Entry: 7 Entry: 7
Data: 9|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor Data: 9|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField - Name: <Name>k__BackingField
Entry: 1 Entry: 1
Data: gameController Data: defaultSpeed
- Name: <UserType>k__BackingField - Name: <UserType>k__BackingField
Entry: 7 Entry: 7
Data: 10|System.RuntimeType, mscorlib Data: 10|System.RuntimeType, mscorlib
- Name: - Name:
Entry: 1 Entry: 1
Data: Marro.PacManUdon.GameManager, Assembly-CSharp Data: System.Single, mscorlib
- Name: - Name:
Entry: 8 Entry: 8
Data: Data:
- Name: <SystemType>k__BackingField - Name: <SystemType>k__BackingField
Entry: 9 Entry: 9
Data: 4 Data: 10
- Name: <SyncMode>k__BackingField - Name: <SyncMode>k__BackingField
Entry: 7 Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -217,127 +217,19 @@ MonoBehaviour:
Data: Data:
- Name: $k - Name: $k
Entry: 1 Entry: 1
Data: input Data: powerPelletSpeed
- Name: $v - Name: $v
Entry: 7 Entry: 7
Data: 12|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor Data: 12|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: input
- Name: <UserType>k__BackingField
Entry: 7
Data: 13|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: Marro.PacManUdon.PlayerInput, Assembly-CSharp
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 9
Data: 4
- 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: 14|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: defaultSpeed
- Name: $v
Entry: 7
Data: 15|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: defaultSpeed
- Name: <UserType>k__BackingField
Entry: 7
Data: 16|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: System.Single, mscorlib
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 9
Data: 16
- 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: 17|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: powerPelletSpeed
- Name: $v
Entry: 7
Data: 18|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField - Name: <Name>k__BackingField
Entry: 1 Entry: 1
Data: powerPelletSpeed Data: powerPelletSpeed
- Name: <UserType>k__BackingField - Name: <UserType>k__BackingField
Entry: 9 Entry: 9
Data: 16 Data: 10
- Name: <SystemType>k__BackingField - Name: <SystemType>k__BackingField
Entry: 9 Entry: 9
Data: 16 Data: 10
- Name: <SyncMode>k__BackingField - Name: <SyncMode>k__BackingField
Entry: 7 Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -352,7 +244,7 @@ MonoBehaviour:
Data: false Data: false
- Name: _fieldAttributes - Name: _fieldAttributes
Entry: 7 Entry: 7
Data: 19|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib Data: 13|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name: - Name:
Entry: 12 Entry: 12
Data: 0 Data: 0
@@ -376,16 +268,124 @@ MonoBehaviour:
Data: speed Data: speed
- Name: $v - Name: $v
Entry: 7 Entry: 7
Data: 20|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor Data: 14|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField - Name: <Name>k__BackingField
Entry: 1 Entry: 1
Data: speed Data: speed
- Name: <UserType>k__BackingField - Name: <UserType>k__BackingField
Entry: 9 Entry: 9
Data: 16 Data: 10
- Name: <SystemType>k__BackingField - Name: <SystemType>k__BackingField
Entry: 9 Entry: 9
Data: 16 Data: 10
- 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: 15|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: startPosition
- Name: $v
Entry: 7
Data: 16|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: startPosition
- Name: <UserType>k__BackingField
Entry: 7
Data: 17|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: UnityEngine.Vector3, UnityEngine.CoreModule
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 9
Data: 17
- 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: 18|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: startRotation
- Name: $v
Entry: 7
Data: 19|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: startRotation
- Name: <UserType>k__BackingField
Entry: 7
Data: 20|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: UnityEngine.Quaternion, UnityEngine.CoreModule
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 9
Data: 20
- Name: <SyncMode>k__BackingField - Name: <SyncMode>k__BackingField
Entry: 7 Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -421,25 +421,19 @@ MonoBehaviour:
Data: Data:
- Name: $k - Name: $k
Entry: 1 Entry: 1
Data: startPosition Data: startScale
- Name: $v - Name: $v
Entry: 7 Entry: 7
Data: 22|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor Data: 22|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField - Name: <Name>k__BackingField
Entry: 1 Entry: 1
Data: startPosition Data: startScale
- Name: <UserType>k__BackingField - Name: <UserType>k__BackingField
Entry: 7 Entry: 9
Data: 23|System.RuntimeType, mscorlib Data: 17
- Name:
Entry: 1
Data: UnityEngine.Vector3, UnityEngine.CoreModule
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField - Name: <SystemType>k__BackingField
Entry: 9 Entry: 9
Data: 23 Data: 17
- Name: <SyncMode>k__BackingField - Name: <SyncMode>k__BackingField
Entry: 7 Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -454,61 +448,7 @@ MonoBehaviour:
Data: false Data: false
- Name: _fieldAttributes - Name: _fieldAttributes
Entry: 7 Entry: 7
Data: 24|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib Data: 23|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: startRotation
- Name: $v
Entry: 7
Data: 25|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: startRotation
- Name: <UserType>k__BackingField
Entry: 7
Data: 26|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: UnityEngine.Quaternion, UnityEngine.CoreModule
- 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: - Name:
Entry: 12 Entry: 12
Data: 0 Data: 0
@@ -532,13 +472,13 @@ MonoBehaviour:
Data: animator Data: animator
- Name: $v - Name: $v
Entry: 7 Entry: 7
Data: 28|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor Data: 24|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField - Name: <Name>k__BackingField
Entry: 1 Entry: 1
Data: animator Data: animator
- Name: <UserType>k__BackingField - Name: <UserType>k__BackingField
Entry: 7 Entry: 7
Data: 29|System.RuntimeType, mscorlib Data: 25|System.RuntimeType, mscorlib
- Name: - Name:
Entry: 1 Entry: 1
Data: UnityEngine.Animator, UnityEngine.AnimationModule Data: UnityEngine.Animator, UnityEngine.AnimationModule
@@ -547,7 +487,7 @@ MonoBehaviour:
Data: Data:
- Name: <SystemType>k__BackingField - Name: <SystemType>k__BackingField
Entry: 9 Entry: 9
Data: 29 Data: 25
- Name: <SyncMode>k__BackingField - Name: <SyncMode>k__BackingField
Entry: 7 Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -562,7 +502,7 @@ MonoBehaviour:
Data: false Data: false
- Name: _fieldAttributes - Name: _fieldAttributes
Entry: 7 Entry: 7
Data: 30|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib Data: 26|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name: - Name:
Entry: 12 Entry: 12
Data: 0 Data: 0
@@ -586,13 +526,13 @@ MonoBehaviour:
Data: renderer Data: renderer
- Name: $v - Name: $v
Entry: 7 Entry: 7
Data: 31|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor Data: 27|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField - Name: <Name>k__BackingField
Entry: 1 Entry: 1
Data: renderer Data: renderer
- Name: <UserType>k__BackingField - Name: <UserType>k__BackingField
Entry: 7 Entry: 7
Data: 32|System.RuntimeType, mscorlib Data: 28|System.RuntimeType, mscorlib
- Name: - Name:
Entry: 1 Entry: 1
Data: UnityEngine.Renderer, UnityEngine.CoreModule Data: UnityEngine.Renderer, UnityEngine.CoreModule
@@ -601,7 +541,7 @@ MonoBehaviour:
Data: Data:
- Name: <SystemType>k__BackingField - Name: <SystemType>k__BackingField
Entry: 9 Entry: 9
Data: 32 Data: 28
- Name: <SyncMode>k__BackingField - Name: <SyncMode>k__BackingField
Entry: 7 Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -616,7 +556,61 @@ MonoBehaviour:
Data: false Data: false
- Name: _fieldAttributes - Name: _fieldAttributes
Entry: 7 Entry: 7
Data: 33|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib 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: 7
Data:
- Name: $k
Entry: 1
Data: pelletPool
- Name: $v
Entry: 7
Data: 30|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: pelletPool
- Name: <UserType>k__BackingField
Entry: 7
Data: 31|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: VRC.SDK3.Components.VRCObjectPool, VRCSDK3
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 9
Data: 31
- 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: 32|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name: - Name:
Entry: 12 Entry: 12
Data: 0 Data: 0
@@ -640,13 +634,13 @@ MonoBehaviour:
Data: hideUntilUnfrozen Data: hideUntilUnfrozen
- Name: $v - Name: $v
Entry: 7 Entry: 7
Data: 34|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor Data: 33|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField - Name: <Name>k__BackingField
Entry: 1 Entry: 1
Data: hideUntilUnfrozen Data: hideUntilUnfrozen
- Name: <UserType>k__BackingField - Name: <UserType>k__BackingField
Entry: 7 Entry: 7
Data: 35|System.RuntimeType, mscorlib Data: 34|System.RuntimeType, mscorlib
- Name: - Name:
Entry: 1 Entry: 1
Data: System.Boolean, mscorlib Data: System.Boolean, mscorlib
@@ -655,7 +649,7 @@ MonoBehaviour:
Data: Data:
- Name: <SystemType>k__BackingField - Name: <SystemType>k__BackingField
Entry: 9 Entry: 9
Data: 35 Data: 34
- Name: <SyncMode>k__BackingField - Name: <SyncMode>k__BackingField
Entry: 7 Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -670,7 +664,7 @@ MonoBehaviour:
Data: false Data: false
- Name: _fieldAttributes - Name: _fieldAttributes
Entry: 7 Entry: 7
Data: 36|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib Data: 35|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name: - Name:
Entry: 12 Entry: 12
Data: 0 Data: 0
@@ -694,16 +688,16 @@ MonoBehaviour:
Data: dead Data: dead
- Name: $v - Name: $v
Entry: 7 Entry: 7
Data: 37|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor Data: 36|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField - Name: <Name>k__BackingField
Entry: 1 Entry: 1
Data: dead Data: dead
- Name: <UserType>k__BackingField - Name: <UserType>k__BackingField
Entry: 9 Entry: 9
Data: 35 Data: 34
- Name: <SystemType>k__BackingField - Name: <SystemType>k__BackingField
Entry: 9 Entry: 9
Data: 35 Data: 34
- Name: <SyncMode>k__BackingField - Name: <SyncMode>k__BackingField
Entry: 7 Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -718,7 +712,7 @@ MonoBehaviour:
Data: false Data: false
- Name: _fieldAttributes - Name: _fieldAttributes
Entry: 7 Entry: 7
Data: 38|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib Data: 37|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name: - Name:
Entry: 12 Entry: 12
Data: 0 Data: 0
@@ -742,16 +736,16 @@ MonoBehaviour:
Data: kinematic Data: kinematic
- Name: $v - Name: $v
Entry: 7 Entry: 7
Data: 39|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor Data: 38|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField - Name: <Name>k__BackingField
Entry: 1 Entry: 1
Data: kinematic Data: kinematic
- Name: <UserType>k__BackingField - Name: <UserType>k__BackingField
Entry: 9 Entry: 9
Data: 35 Data: 34
- Name: <SystemType>k__BackingField - Name: <SystemType>k__BackingField
Entry: 9 Entry: 9
Data: 35 Data: 34
- Name: <SyncMode>k__BackingField - Name: <SyncMode>k__BackingField
Entry: 7 Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -766,7 +760,7 @@ MonoBehaviour:
Data: false Data: false
- Name: _fieldAttributes - Name: _fieldAttributes
Entry: 7 Entry: 7
Data: 40|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib Data: 39|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name: - Name:
Entry: 12 Entry: 12
Data: 0 Data: 0
@@ -790,16 +784,16 @@ MonoBehaviour:
Data: followingPredefinedPath Data: followingPredefinedPath
- Name: $v - Name: $v
Entry: 7 Entry: 7
Data: 41|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor Data: 40|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField - Name: <Name>k__BackingField
Entry: 1 Entry: 1
Data: followingPredefinedPath Data: followingPredefinedPath
- Name: <UserType>k__BackingField - Name: <UserType>k__BackingField
Entry: 9 Entry: 9
Data: 35 Data: 34
- Name: <SystemType>k__BackingField - Name: <SystemType>k__BackingField
Entry: 9 Entry: 9
Data: 35 Data: 34
- Name: <SyncMode>k__BackingField - Name: <SyncMode>k__BackingField
Entry: 7 Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -814,7 +808,7 @@ MonoBehaviour:
Data: false Data: false
- Name: _fieldAttributes - Name: _fieldAttributes
Entry: 7 Entry: 7
Data: 42|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib Data: 41|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name: - Name:
Entry: 12 Entry: 12
Data: 0 Data: 0
@@ -838,13 +832,13 @@ MonoBehaviour:
Data: predefinedPath Data: predefinedPath
- Name: $v - Name: $v
Entry: 7 Entry: 7
Data: 43|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor Data: 42|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField - Name: <Name>k__BackingField
Entry: 1 Entry: 1
Data: predefinedPath Data: predefinedPath
- Name: <UserType>k__BackingField - Name: <UserType>k__BackingField
Entry: 7 Entry: 7
Data: 44|System.RuntimeType, mscorlib Data: 43|System.RuntimeType, mscorlib
- Name: - Name:
Entry: 1 Entry: 1
Data: UnityEngine.Vector2[], UnityEngine.CoreModule Data: UnityEngine.Vector2[], UnityEngine.CoreModule
@@ -853,7 +847,7 @@ MonoBehaviour:
Data: Data:
- Name: <SystemType>k__BackingField - Name: <SystemType>k__BackingField
Entry: 9 Entry: 9
Data: 44 Data: 43
- Name: <SyncMode>k__BackingField - Name: <SyncMode>k__BackingField
Entry: 7 Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -868,7 +862,7 @@ MonoBehaviour:
Data: false Data: false
- Name: _fieldAttributes - Name: _fieldAttributes
Entry: 7 Entry: 7
Data: 45|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib Data: 44|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name: - Name:
Entry: 12 Entry: 12
Data: 0 Data: 0
@@ -892,13 +886,13 @@ MonoBehaviour:
Data: predefinedPathIndex Data: predefinedPathIndex
- Name: $v - Name: $v
Entry: 7 Entry: 7
Data: 46|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor Data: 45|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField - Name: <Name>k__BackingField
Entry: 1 Entry: 1
Data: predefinedPathIndex Data: predefinedPathIndex
- Name: <UserType>k__BackingField - Name: <UserType>k__BackingField
Entry: 7 Entry: 7
Data: 47|System.RuntimeType, mscorlib Data: 46|System.RuntimeType, mscorlib
- Name: - Name:
Entry: 1 Entry: 1
Data: System.Int32, mscorlib Data: System.Int32, mscorlib
@@ -907,7 +901,7 @@ MonoBehaviour:
Data: Data:
- Name: <SystemType>k__BackingField - Name: <SystemType>k__BackingField
Entry: 9 Entry: 9
Data: 47 Data: 46
- Name: <SyncMode>k__BackingField - Name: <SyncMode>k__BackingField
Entry: 7 Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -922,7 +916,7 @@ MonoBehaviour:
Data: false Data: false
- Name: _fieldAttributes - Name: _fieldAttributes
Entry: 7 Entry: 7
Data: 48|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib Data: 47|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name: - Name:
Entry: 12 Entry: 12
Data: 0 Data: 0
@@ -943,25 +937,31 @@ MonoBehaviour:
Data: Data:
- Name: $k - Name: $k
Entry: 1 Entry: 1
Data: targetDirection Data: syncedPosition
- Name: $v - Name: $v
Entry: 7 Entry: 7
Data: 49|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor Data: 48|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField - Name: <Name>k__BackingField
Entry: 1 Entry: 1
Data: targetDirection Data: syncedPosition
- Name: <UserType>k__BackingField - Name: <UserType>k__BackingField
Entry: 9 Entry: 7
Data: 7 Data: 49|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: UnityEngine.Vector2, UnityEngine.CoreModule
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField - Name: <SystemType>k__BackingField
Entry: 9 Entry: 9
Data: 7 Data: 49
- Name: <SyncMode>k__BackingField - Name: <SyncMode>k__BackingField
Entry: 7 Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
- Name: - Name:
Entry: 6 Entry: 3
Data: Data: 1
- Name: - Name:
Entry: 8 Entry: 8
Data: Data:
@@ -973,7 +973,121 @@ MonoBehaviour:
Data: 50|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib Data: 50|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name: - Name:
Entry: 12 Entry: 12
Data: 0 Data: 1
- Name:
Entry: 7
Data: 51|UdonSharp.UdonSyncedAttribute, UdonSharp.Runtime
- Name:
Entry: 8
Data:
- 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: targetDirection
- Name: $v
Entry: 7
Data: 52|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: targetDirection
- Name: <UserType>k__BackingField
Entry: 9
Data: 49
- Name: <SystemType>k__BackingField
Entry: 9
Data: 49
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
- Name:
Entry: 3
Data: 1
- Name:
Entry: 8
Data:
- Name: <IsSerialized>k__BackingField
Entry: 5
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 53|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 1
- Name:
Entry: 7
Data: 54|UdonSharp.UdonSyncedAttribute, UdonSharp.Runtime
- Name:
Entry: 8
Data:
- 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: direction
- Name: $v
Entry: 7
Data: 55|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: direction
- Name: <UserType>k__BackingField
Entry: 9
Data: 49
- Name: <SystemType>k__BackingField
Entry: 9
Data: 49
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
- Name:
Entry: 3
Data: 1
- Name:
Entry: 8
Data:
- Name: <IsSerialized>k__BackingField
Entry: 5
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 56|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 1
- Name:
Entry: 7
Data: 57|UdonSharp.UdonSyncedAttribute, UdonSharp.Runtime
- Name:
Entry: 8
Data:
- Name: - Name:
Entry: 13 Entry: 13
Data: Data:
@@ -994,22 +1108,22 @@ MonoBehaviour:
Data: freezeSeconds Data: freezeSeconds
- Name: $v - Name: $v
Entry: 7 Entry: 7
Data: 51|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor Data: 58|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField - Name: <Name>k__BackingField
Entry: 1 Entry: 1
Data: freezeSeconds Data: freezeSeconds
- Name: <UserType>k__BackingField - Name: <UserType>k__BackingField
Entry: 9 Entry: 9
Data: 16 Data: 10
- Name: <SystemType>k__BackingField - Name: <SystemType>k__BackingField
Entry: 9 Entry: 9
Data: 16 Data: 10
- Name: <SyncMode>k__BackingField - Name: <SyncMode>k__BackingField
Entry: 7 Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
- Name: - Name:
Entry: 6 Entry: 3
Data: Data: 1
- Name: - Name:
Entry: 8 Entry: 8
Data: Data:
@@ -1018,10 +1132,16 @@ MonoBehaviour:
Data: false Data: false
- Name: _fieldAttributes - Name: _fieldAttributes
Entry: 7 Entry: 7
Data: 52|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib Data: 59|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name: - Name:
Entry: 12 Entry: 12
Data: 0 Data: 1
- Name:
Entry: 7
Data: 60|UdonSharp.UdonSyncedAttribute, UdonSharp.Runtime
- Name:
Entry: 8
Data:
- Name: - Name:
Entry: 13 Entry: 13
Data: Data:
@@ -1042,22 +1162,22 @@ MonoBehaviour:
Data: frozen Data: frozen
- Name: $v - Name: $v
Entry: 7 Entry: 7
Data: 53|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor Data: 61|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField - Name: <Name>k__BackingField
Entry: 1 Entry: 1
Data: frozen Data: frozen
- Name: <UserType>k__BackingField - Name: <UserType>k__BackingField
Entry: 9 Entry: 9
Data: 35 Data: 34
- Name: <SystemType>k__BackingField - Name: <SystemType>k__BackingField
Entry: 9 Entry: 9
Data: 35 Data: 34
- Name: <SyncMode>k__BackingField - Name: <SyncMode>k__BackingField
Entry: 7 Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
- Name: - Name:
Entry: 6 Entry: 3
Data: Data: 1
- Name: - Name:
Entry: 8 Entry: 8
Data: Data:
@@ -1066,10 +1186,16 @@ MonoBehaviour:
Data: false Data: false
- Name: _fieldAttributes - Name: _fieldAttributes
Entry: 7 Entry: 7
Data: 54|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib Data: 62|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name: - Name:
Entry: 12 Entry: 12
Data: 0 Data: 1
- Name:
Entry: 7
Data: 63|UdonSharp.UdonSyncedAttribute, UdonSharp.Runtime
- Name:
Entry: 8
Data:
- Name: - Name:
Entry: 13 Entry: 13
Data: Data:

View File

@@ -1,10 +1,12 @@
using System; namespace Marro.PacManUdon
using UnityEngine;
namespace Marro.PacManUdon
{ {
[RequireComponent(typeof(Animator))] using System;
[RequireComponent(typeof(Renderer))] using UdonSharp;
using UnityEngine;
using VRC.SDKBase;
using VRC.Udon;
using VRC.SDK3.Components;
public class PacMan : GridMover public class PacMan : GridMover
{ {
private GameManager gameController; private GameManager gameController;
@@ -14,8 +16,10 @@ namespace Marro.PacManUdon
private float speed; private float speed;
private Vector3 startPosition; private Vector3 startPosition;
private Quaternion startRotation; private Quaternion startRotation;
private Vector3 startScale;
private Animator animator; private Animator animator;
new Renderer renderer; new Renderer renderer;
private VRCObjectPool pelletPool;
private bool hideUntilUnfrozen; private bool hideUntilUnfrozen;
private bool dead; private bool dead;
private bool kinematic; private bool kinematic;
@@ -24,11 +28,13 @@ namespace Marro.PacManUdon
private Vector2[] predefinedPath; private Vector2[] predefinedPath;
private int predefinedPathIndex; private int predefinedPathIndex;
private Vector2 targetDirection; [UdonSynced] private Vector2 syncedPosition;
private float freezeSeconds; [UdonSynced] private Vector2 targetDirection;
private bool frozen; [UdonSynced] private Vector2 direction;
[UdonSynced] private float freezeSeconds;
[UdonSynced] private bool frozen;
#region Animator constants #region Animator constants
private const string AnimatorKeyDead = "Dead"; private const string AnimatorKeyDead = "Dead";
private const string AnimatorKeyDirection = "Direction"; private const string AnimatorKeyDirection = "Direction";
private const float AnimatorDirectionNone = 0f; private const float AnimatorDirectionNone = 0f;
@@ -37,24 +43,29 @@ namespace Marro.PacManUdon
private const float AnimatorDirectionUp = 0.75f; private const float AnimatorDirectionUp = 0.75f;
private const float AnimatorDirectionDown = 1f; private const float AnimatorDirectionDown = 1f;
private const float AnimatorDirectionRightBig = 1.25f; private const float AnimatorDirectionRightBig = 1.25f;
#endregion #endregion
public void Initialize(PlayerInput input, Transform startTransform, GameManager gameController) public void Initialize(PlayerInput input, VRCObjectPool pelletPool, GameManager gameController)
{ {
this.gameController = gameController; this.gameController = gameController;
this.input = input; this.input = input;
this.pelletPool = pelletPool;
animator = GetComponent<Animator>(); animator = GetComponent<Animator>();
renderer = GetComponent<Renderer>(); renderer = GetComponent<Renderer>();
frozen = false; frozen = false;
hideUntilUnfrozen = false; hideUntilUnfrozen = false;
startPosition = startTransform.localPosition; startPosition = transform.localPosition;
startRotation = startTransform.localRotation; startRotation = transform.localRotation;
startScale = transform.localScale;
} }
public void Reset() public void Reset()
{ {
transform.SetLocalPositionAndRotation(startPosition, startRotation); // Debug.Log($"{gameObject} Reset!");
transform.localPosition = startPosition;
transform.localRotation = startRotation;
transform.localScale = startScale;
direction = Vector2.left; direction = Vector2.left;
targetDirection = Vector2.left; targetDirection = Vector2.left;
speed = defaultSpeed; speed = defaultSpeed;
@@ -63,11 +74,9 @@ namespace Marro.PacManUdon
SetDead(false); SetDead(false);
animator.SetTrigger("Reset"); animator.SetTrigger("Reset");
Debug.Log($"{gameObject} Reset! Position is now {GetPosition()}.");
} }
public override void SyncedUpdate() void FixedUpdate()
{ {
// gameStateManager.statusDisplay.SetDebugText(1, this.targetDirection.ToString()); // gameStateManager.statusDisplay.SetDebugText(1, this.targetDirection.ToString());
@@ -85,10 +94,10 @@ namespace Marro.PacManUdon
float speed = this.speed; float speed = this.speed;
if (freezeSeconds > 0) if (freezeSeconds > 0)
{ {
float freezePart = freezeSeconds / networkManager.SyncedDeltaTime; float freezePart = freezeSeconds / Time.deltaTime;
if (freezePart >= 1) if (freezePart >= 1)
{ {
freezeSeconds -= networkManager.SyncedDeltaTime; freezeSeconds -= Time.deltaTime;
animator.speed = 0; animator.speed = 0;
return; return;
} }
@@ -102,7 +111,7 @@ namespace Marro.PacManUdon
} }
Vector2 position = GetPosition(); Vector2 position = GetPosition();
Vector2 nextPosition = GridMoverTools.GetNextPosition(position, direction, speed, networkManager.SyncedDeltaTime); // The position pacman will move to, assuming it doens't get changed Vector2 nextPosition = GridMoverTools.GetNextPosition(position, direction, speed); // The position pacman will move to, assuming it doens't get changed
if (!kinematic) if (!kinematic)
{ {
@@ -137,6 +146,8 @@ namespace Marro.PacManUdon
// Debug.Log($"{gameObject} crossed Y tile center from {currentPosition} with targetDirection {targetDirection}, nextPosition is now {nextPosition} and direction is now {direction}"); // Debug.Log($"{gameObject} crossed Y tile center from {currentPosition} with targetDirection {targetDirection}, nextPosition is now {nextPosition} and direction is now {direction}");
} }
if (Networking.IsOwner(gameObject))
{
Vector2 inputDirection = input.GetDirection(); Vector2 inputDirection = input.GetDirection();
if (!inputDirection.Equals(Vector2.zero) && !inputDirection.Equals(targetDirection) // Ignore neutral input or input in our current direction if (!inputDirection.Equals(Vector2.zero) && !inputDirection.Equals(targetDirection) // Ignore neutral input or input in our current direction
&& (inputDirection.x == 0 || (Math.Round(nextPosition.y, 5) - 0.5) % 1 != 0) && (inputDirection.y == 0 || (Math.Round(nextPosition.x, 5) - 0.5) % 1 != 0) // Target grid position near the edge of a tile may not be correct, ignore inputs near the border && (inputDirection.x == 0 || (Math.Round(nextPosition.y, 5) - 0.5) % 1 != 0) && (inputDirection.y == 0 || (Math.Round(nextPosition.x, 5) - 0.5) % 1 != 0) // Target grid position near the edge of a tile may not be correct, ignore inputs near the border
@@ -151,7 +162,7 @@ namespace Marro.PacManUdon
SetDirection(inputDirection + new Vector2(GridMoverTools.PositionToGrid(nextPosition).x - nextPosition.x, 0).normalized); SetDirection(inputDirection + new Vector2(GridMoverTools.PositionToGrid(nextPosition).x - nextPosition.x, 0).normalized);
} }
SetTargetDirection(inputDirection); // This is the direction most logic should assume pacman is moving, the actual direction may be different due to cornering SetTargetDirection(inputDirection); // This is the direction most logic should assume pacman is moving, the actual direction may be different due to cornering
networkManager.SendEventSoon(NetworkEventType.PacManTurn); }
} }
return nextPosition; return nextPosition;
@@ -196,7 +207,7 @@ namespace Marro.PacManUdon
return nextPosition; return nextPosition;
} }
protected override void UpdateAnimator() private void UpdateAnimator()
{ {
// Debug.Log($"{gameObject} UpdateAnimator with direction {direction}, dead {dead}, frozen {frozen}"); // Debug.Log($"{gameObject} UpdateAnimator with direction {direction}, dead {dead}, frozen {frozen}");
if (!gameObject.activeInHierarchy) if (!gameObject.activeInHierarchy)
@@ -305,57 +316,78 @@ namespace Marro.PacManUdon
renderer.enabled = visible; renderer.enabled = visible;
} }
public override Vector2 GetPosition()
{
return (Vector2)transform.localPosition;
}
public override void SetPosition(Vector2 position)
{
GridMoverTools.SetPosition(position, transform);
}
public override Vector2 GetDirection()
{
return direction;
}
public void SetDirection(Vector2 direction)
{
this.direction = direction;
RequestSerialization();
UpdateAnimator();
}
public void SetTargetDirection(Vector2 targetDirection) public void SetTargetDirection(Vector2 targetDirection)
{ {
this.targetDirection = targetDirection; this.targetDirection = targetDirection;
UpdateAnimator(); UpdateAnimator();
} }
public override void OnPreSerialization()
{
syncedPosition = GetPosition();
}
public override void OnDeserialization()
{
SetPosition(syncedPosition);
UpdateAnimator();
}
void OnTriggerEnter(Collider other) void OnTriggerEnter(Collider other)
{ {
Pellet pellet = other.gameObject.GetComponent<Pellet>(); Pellet pellet = other.gameObject.GetComponent<Pellet>();
if (pellet) if (pellet)
{ {
if (Networking.IsOwner(gameObject))
{
pelletPool.Return(pellet.gameObject);
}
else
{
pellet.pelletRenderer.enabled = false;
pellet.gameObject.SetActive(false);
}
if (pellet.isPowerPellet) if (pellet.isPowerPellet)
{ {
gameController.GotPowerPellet(pellet); if (Networking.IsOwner(gameObject)) gameController.GotPowerPellet();
freezeSeconds = 0.05f; freezeSeconds = 0.05f;
} }
else else
{ {
gameController.GotPellet(pellet); if (Networking.IsOwner(gameObject)) gameController.GotPellet();
freezeSeconds = 0.0166666666666667f; freezeSeconds = 0.0166666666666667f;
} }
if (Networking.IsOwner(gameObject)) RequestSerialization();
return; return;
} }
else if (other.gameObject.GetComponent<BonusFruit>()) else if (Networking.IsOwner(gameObject) && other.gameObject.GetComponent<BonusFruit>())
{ {
gameController.GotFruit(); gameController.GotFruit();
} }
} }
public override void CollectSyncedData(byte[] data, ref int index, NetworkEventType eventType)
{
if (eventType != NetworkEventType.PacManTurn || kinematic || frozen || !enabled)
{
return;
}
data.Append(targetDirection, ref index);
base.CollectSyncedData(data, ref index, eventType);
}
public override bool WriteSyncedData(byte[] data, ref int index, NetworkEventType eventType)
{
if (eventType != NetworkEventType.PacManTurn || kinematic || frozen || !enabled)
{
return true;
}
SetTargetDirection(data.ReadVector2(ref index));
return base.WriteSyncedData(data, ref index, eventType);
}
} }
} }

View File

@@ -85,7 +85,13 @@ MonoBehaviour:
Data: 4|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib Data: 4|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name: - Name:
Entry: 12 Entry: 12
Data: 0 Data: 1
- Name:
Entry: 7
Data: 5|UnityEngine.SerializeField, UnityEngine.CoreModule
- Name:
Entry: 8
Data:
- Name: - Name:
Entry: 13 Entry: 13
Data: Data:
@@ -106,13 +112,13 @@ MonoBehaviour:
Data: pelletRenderer Data: pelletRenderer
- Name: $v - Name: $v
Entry: 7 Entry: 7
Data: 5|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor Data: 6|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField - Name: <Name>k__BackingField
Entry: 1 Entry: 1
Data: pelletRenderer Data: pelletRenderer
- Name: <UserType>k__BackingField - Name: <UserType>k__BackingField
Entry: 7 Entry: 7
Data: 6|System.RuntimeType, mscorlib Data: 7|System.RuntimeType, mscorlib
- Name: - Name:
Entry: 1 Entry: 1
Data: UnityEngine.Renderer, UnityEngine.CoreModule Data: UnityEngine.Renderer, UnityEngine.CoreModule
@@ -121,7 +127,7 @@ MonoBehaviour:
Data: Data:
- Name: <SystemType>k__BackingField - Name: <SystemType>k__BackingField
Entry: 9 Entry: 9
Data: 6 Data: 7
- Name: <SyncMode>k__BackingField - Name: <SyncMode>k__BackingField
Entry: 7 Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -136,7 +142,7 @@ MonoBehaviour:
Data: true Data: true
- Name: _fieldAttributes - Name: _fieldAttributes
Entry: 7 Entry: 7
Data: 7|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib Data: 8|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name: - Name:
Entry: 12 Entry: 12
Data: 0 Data: 0

View File

@@ -3,10 +3,9 @@
using UdonSharp; using UdonSharp;
using UnityEngine; using UnityEngine;
[RequireComponent(typeof(Renderer))]
public class Pellet : UdonSharpBehaviour public class Pellet : UdonSharpBehaviour
{ {
public bool isPowerPellet = false; [SerializeField] public bool isPowerPellet = false;
public Renderer pelletRenderer; public Renderer pelletRenderer;
void Start() void Start()

View File

@@ -43,25 +43,25 @@ MonoBehaviour:
Data: Data:
- Name: - Name:
Entry: 12 Entry: 12
Data: 9 Data: 8
- Name: - Name:
Entry: 7 Entry: 7
Data: Data:
- Name: $k - Name: $k
Entry: 1 Entry: 1
Data: networkManager Data: pellets
- Name: $v - Name: $v
Entry: 7 Entry: 7
Data: 2|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor Data: 2|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField - Name: <Name>k__BackingField
Entry: 1 Entry: 1
Data: networkManager Data: pellets
- Name: <UserType>k__BackingField - Name: <UserType>k__BackingField
Entry: 7 Entry: 7
Data: 3|System.RuntimeType, mscorlib Data: 3|System.RuntimeType, mscorlib
- Name: - Name:
Entry: 1 Entry: 1
Data: Marro.PacManUdon.NetworkManager, Assembly-CSharp Data: Marro.PacManUdon.Pellet[], Assembly-CSharp
- Name: - Name:
Entry: 8 Entry: 8
Data: Data:
@@ -70,7 +70,7 @@ MonoBehaviour:
Data: 4|System.RuntimeType, mscorlib Data: 4|System.RuntimeType, mscorlib
- Name: - Name:
Entry: 1 Entry: 1
Data: VRC.Udon.UdonBehaviour, VRC.Udon Data: UnityEngine.Component[], UnityEngine.CoreModule
- Name: - Name:
Entry: 8 Entry: 8
Data: Data:
@@ -91,7 +91,13 @@ MonoBehaviour:
Data: 5|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib Data: 5|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name: - Name:
Entry: 12 Entry: 12
Data: 0 Data: 1
- Name:
Entry: 7
Data: 6|UnityEngine.SerializeField, UnityEngine.CoreModule
- Name:
Entry: 8
Data:
- Name: - Name:
Entry: 13 Entry: 13
Data: Data:
@@ -109,25 +115,25 @@ MonoBehaviour:
Data: Data:
- Name: $k - Name: $k
Entry: 1 Entry: 1
Data: <PelletCollectedCount>k__BackingField Data: pelletPool
- Name: $v - Name: $v
Entry: 7 Entry: 7
Data: 6|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor Data: 7|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField - Name: <Name>k__BackingField
Entry: 1 Entry: 1
Data: <PelletCollectedCount>k__BackingField Data: pelletPool
- Name: <UserType>k__BackingField - Name: <UserType>k__BackingField
Entry: 7 Entry: 7
Data: 7|System.RuntimeType, mscorlib Data: 8|System.RuntimeType, mscorlib
- Name: - Name:
Entry: 1 Entry: 1
Data: System.Int32, mscorlib Data: VRC.SDK3.Components.VRCObjectPool, VRCSDK3
- Name: - Name:
Entry: 8 Entry: 8
Data: Data:
- Name: <SystemType>k__BackingField - Name: <SystemType>k__BackingField
Entry: 9 Entry: 9
Data: 7 Data: 8
- Name: <SyncMode>k__BackingField - Name: <SyncMode>k__BackingField
Entry: 7 Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -142,7 +148,7 @@ MonoBehaviour:
Data: false Data: false
- Name: _fieldAttributes - Name: _fieldAttributes
Entry: 7 Entry: 7
Data: 8|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib Data: 9|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name: - Name:
Entry: 12 Entry: 12
Data: 0 Data: 0
@@ -163,31 +169,25 @@ MonoBehaviour:
Data: Data:
- Name: $k - Name: $k
Entry: 1 Entry: 1
Data: pellets Data: pelletRenderers
- Name: $v - Name: $v
Entry: 7 Entry: 7
Data: 9|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor Data: 10|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField - Name: <Name>k__BackingField
Entry: 1 Entry: 1
Data: pellets Data: pelletRenderers
- Name: <UserType>k__BackingField - Name: <UserType>k__BackingField
Entry: 7
Data: 10|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: Marro.PacManUdon.Pellet[], Assembly-CSharp
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 7 Entry: 7
Data: 11|System.RuntimeType, mscorlib Data: 11|System.RuntimeType, mscorlib
- Name: - Name:
Entry: 1 Entry: 1
Data: UnityEngine.Component[], UnityEngine.CoreModule Data: UnityEngine.Renderer[], UnityEngine.CoreModule
- Name: - Name:
Entry: 8 Entry: 8
Data: Data:
- Name: <SystemType>k__BackingField
Entry: 9
Data: 11
- Name: <SyncMode>k__BackingField - Name: <SyncMode>k__BackingField
Entry: 7 Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -476,60 +476,6 @@ MonoBehaviour:
- Name: - Name:
Entry: 8 Entry: 8
Data: Data:
- Name:
Entry: 7
Data:
- Name: $k
Entry: 1
Data: syncedPelletsCollected
- Name: $v
Entry: 7
Data: 26|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: syncedPelletsCollected
- Name: <UserType>k__BackingField
Entry: 7
Data: 27|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: System.Byte[], mscorlib
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 9
Data: 27
- 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: 28|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: - Name:
Entry: 13 Entry: 13
Data: Data:

View File

@@ -1,43 +1,61 @@
using System; namespace Marro.PacManUdon
using UnityEngine;
namespace Marro.PacManUdon
{ {
public class PelletManager : SyncedObject using UdonSharp;
{ using UnityEngine;
public int PelletCount => pellets.Length; using VRC.SDK3.Components;
public int PelletCollectedCount { get; private set; } using VRC.SDKBase;
using VRC.Udon;
Pellet[] pellets; public class PelletManager : UdonSharpBehaviour
{
[SerializeField] Pellet[] pellets;
VRCObjectPool pelletPool;
Renderer[] pelletRenderers;
Animator[] powerPellets; Animator[] powerPellets;
bool powerPelletBlinkEnabled; bool powerPelletBlinkEnabled;
float powerPelletBlinkToggleInterval; float powerPelletBlinkToggleInterval;
float powerPelletBlinkProgress; float powerPelletBlinkProgress;
bool powerPelletBlinkCurrentlyVisible; bool powerPelletBlinkCurrentlyVisible;
byte[] syncedPelletsCollected; public void Initialize(VRCObjectPool pelletPool)
{
gameObject.SetActive(true);
this.pelletPool = pelletPool;
pelletRenderers = new Renderer[pelletPool.Pool.Length];
for (int i = 0; i < pelletRenderers.Length; i++)
{
pelletRenderers[i] = pelletPool.Pool[i].GetComponent<Renderer>();
}
powerPellets = GetComponentsInChildren<Animator>(true);
// Debug.Log($"{gameObject} Initialized, powerPellets: {powerPellets}");
powerPelletBlinkToggleInterval = PacManConstants.GetPowerPelletBlinkToggleInterval();
SetPowerPelletsBlink(false);
}
public void Initialize() public void Initialize()
{ {
gameObject.SetActive(true); pelletRenderers = new Renderer[pellets.Length];
pellets = GetComponentsInChildren<Pellet>(includeInactive: true); for (int i = 0; i < pelletRenderers.Length; i++)
{
pelletRenderers[i] = pellets[i].GetComponent<Renderer>();
}
powerPellets = GetComponentsInChildren<Animator>(true); powerPellets = GetComponentsInChildren<Animator>(true);
powerPelletBlinkToggleInterval = PacManConstants.GetPowerPelletBlinkToggleInterval(); powerPelletBlinkToggleInterval = PacManConstants.GetPowerPelletBlinkToggleInterval();
SetPowerPelletsBlink(false); SetPowerPelletsBlink(false);
RestoreAllPellets();
} }
public override void SyncedUpdate() void Update()
{ {
if (!powerPelletBlinkEnabled) if (!powerPelletBlinkEnabled)
{ {
return; return;
} }
powerPelletBlinkProgress += networkManager.SyncedDeltaTime; powerPelletBlinkProgress += Time.deltaTime;
if (powerPelletBlinkProgress >= powerPelletBlinkToggleInterval) if (powerPelletBlinkProgress >= powerPelletBlinkToggleInterval)
{ {
// Debug.Log($"{gameObject} PowerPelletBlink toggle"); // Debug.Log($"{gameObject} PowerPelletBlink toggle");
@@ -71,63 +89,20 @@ namespace Marro.PacManUdon
powerPelletBlinkEnabled = !frozen; powerPelletBlinkEnabled = !frozen;
} }
public int PelletCollected(Pellet pellet) public void RestoreAllPellets()
{ {
pellet.gameObject.SetActive(false); foreach (GameObject pellet in pelletPool.Pool)
var index = pellet.transform.GetSiblingIndex();
syncedPelletsCollected[index/8] |= (byte)(1 << index%8);
PelletCollectedCount++;
return PelletCollectedCount;
}
public int RestoreAllPellets()
{ {
foreach (var pellet in pellets) if (pelletPool.TryToSpawn() == false)
{ {
pellet.gameObject.SetActive(true); break;
}
syncedPelletsCollected = new byte[pellets.Length/8 + 1];
PelletCollectedCount = 0;
return PelletCount;
}
private void SetPelletsCollectedFromSync()
{
for (int i = 0; i < pellets.Length; i++)
{
var active = (syncedPelletsCollected[i/8] & (byte)(1 << i%8)) == 0;
pellets[i].gameObject.SetActive(active);
} }
} }
public override void CollectSyncedData(byte[] data, ref int index, NetworkEventType eventType) foreach (Renderer pelletRenderer in pelletRenderers)
{ {
if (eventType != NetworkEventType.SyncPellets) pelletRenderer.enabled = true;
{
return;
} }
data.Append((byte)PelletCollectedCount, ref index);
data.Append(syncedPelletsCollected, ref index);
}
public override bool WriteSyncedData(byte[] data, ref int index, NetworkEventType eventType)
{
if (eventType != NetworkEventType.SyncPellets)
{
return true;
}
PelletCollectedCount = data.ReadByte(ref index);
Array.Copy(data, index, syncedPelletsCollected, 0, syncedPelletsCollected.Length);
index += syncedPelletsCollected.Length;
SetPelletsCollectedFromSync();
return true;
} }
} }
} }

View File

@@ -103,13 +103,13 @@ MonoBehaviour:
Data: Data:
- Name: $k - Name: $k
Entry: 1 Entry: 1
Data: gameManager Data: gameController
- Name: $v - Name: $v
Entry: 7 Entry: 7
Data: 5|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor Data: 5|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField - Name: <Name>k__BackingField
Entry: 1 Entry: 1
Data: gameManager Data: gameController
- Name: <UserType>k__BackingField - Name: <UserType>k__BackingField
Entry: 7 Entry: 7
Data: 6|System.RuntimeType, mscorlib Data: 6|System.RuntimeType, mscorlib

View File

@@ -10,7 +10,7 @@
public class PlayerInput : UdonSharpBehaviour public class PlayerInput : UdonSharpBehaviour
{ {
public bool active; public bool active;
private GameManager gameManager; private GameManager gameController;
Vector2 inputHorizontal; Vector2 inputHorizontal;
Vector2 inputVertical; Vector2 inputVertical;
float horizontalValue; float horizontalValue;
@@ -18,9 +18,9 @@
bool horizontalPriority; bool horizontalPriority;
VRCPlayerApi player; VRCPlayerApi player;
public void Initialize(GameManager gameManager) public void Initialize(GameManager gameController)
{ {
this.gameManager = gameManager; this.gameController = gameController;
inputHorizontal = Vector2.zero; inputHorizontal = Vector2.zero;
inputVertical = Vector2.zero; inputVertical = Vector2.zero;
horizontalPriority = false; horizontalPriority = false;
@@ -35,7 +35,7 @@
player.SetRunSpeed(0); player.SetRunSpeed(0);
player.SetStrafeSpeed(0); player.SetStrafeSpeed(0);
gameManager.JoystickGrabbed(); gameController.JoystickGrabbed();
} }
public void Deactivate() public void Deactivate()
@@ -46,7 +46,7 @@
player.SetStrafeSpeed(2); player.SetStrafeSpeed(2);
active = false; active = false;
gameManager.JoystickReleased(); gameController.JoystickReleased();
} }
public override void InputJump(bool pressed, UdonInputEventArgs args) public override void InputJump(bool pressed, UdonInputEventArgs args)
@@ -128,7 +128,6 @@
// horizontalPriority = true; // horizontalPriority = true;
SetPriority(true); SetPriority(true);
} }
// Debug.Log("Vertical Input Event: " + value + " | Direction: " + direction + " | lastDirection : " + lastDirection); // Debug.Log("Vertical Input Event: " + value + " | Direction: " + direction + " | lastDirection : " + lastDirection);
} }

View File

@@ -43,82 +43,22 @@ MonoBehaviour:
Data: Data:
- Name: - Name:
Entry: 12 Entry: 12
Data: 4 Data: 3
- Name: - Name:
Entry: 7 Entry: 7
Data: Data:
- Name: $k - Name: $k
Entry: 1 Entry: 1
Data: networkManager Data: animator
- Name: $v - Name: $v
Entry: 7 Entry: 7
Data: 2|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor Data: 2|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField - Name: <Name>k__BackingField
Entry: 1 Entry: 1
Data: networkManager Data: animator
- Name: <UserType>k__BackingField - Name: <UserType>k__BackingField
Entry: 7 Entry: 7
Data: 3|System.RuntimeType, mscorlib Data: 3|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: Marro.PacManUdon.NetworkManager, Assembly-CSharp
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 7
Data: 4|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: VRC.Udon.UdonBehaviour, VRC.Udon
- Name:
Entry: 8
Data:
- 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: 5|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: animator
- Name: $v
Entry: 7
Data: 6|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: animator
- Name: <UserType>k__BackingField
Entry: 7
Data: 7|System.RuntimeType, mscorlib
- Name: - Name:
Entry: 1 Entry: 1
Data: UnityEngine.Animator, UnityEngine.AnimationModule Data: UnityEngine.Animator, UnityEngine.AnimationModule
@@ -127,7 +67,7 @@ MonoBehaviour:
Data: Data:
- Name: <SystemType>k__BackingField - Name: <SystemType>k__BackingField
Entry: 9 Entry: 9
Data: 7 Data: 3
- Name: <SyncMode>k__BackingField - Name: <SyncMode>k__BackingField
Entry: 7 Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -142,7 +82,7 @@ MonoBehaviour:
Data: false Data: false
- Name: _fieldAttributes - Name: _fieldAttributes
Entry: 7 Entry: 7
Data: 8|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib Data: 4|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name: - Name:
Entry: 12 Entry: 12
Data: 0 Data: 0
@@ -166,13 +106,13 @@ MonoBehaviour:
Data: countdownSeconds Data: countdownSeconds
- Name: $v - Name: $v
Entry: 7 Entry: 7
Data: 9|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor Data: 5|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField - Name: <Name>k__BackingField
Entry: 1 Entry: 1
Data: countdownSeconds Data: countdownSeconds
- Name: <UserType>k__BackingField - Name: <UserType>k__BackingField
Entry: 7 Entry: 7
Data: 10|System.RuntimeType, mscorlib Data: 6|System.RuntimeType, mscorlib
- Name: - Name:
Entry: 1 Entry: 1
Data: System.Single, mscorlib Data: System.Single, mscorlib
@@ -181,7 +121,7 @@ MonoBehaviour:
Data: Data:
- Name: <SystemType>k__BackingField - Name: <SystemType>k__BackingField
Entry: 9 Entry: 9
Data: 10 Data: 6
- Name: <SyncMode>k__BackingField - Name: <SyncMode>k__BackingField
Entry: 7 Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -196,7 +136,7 @@ MonoBehaviour:
Data: false Data: false
- Name: _fieldAttributes - Name: _fieldAttributes
Entry: 7 Entry: 7
Data: 11|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib Data: 7|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name: - Name:
Entry: 12 Entry: 12
Data: 0 Data: 0
@@ -220,13 +160,13 @@ MonoBehaviour:
Data: countingDown Data: countingDown
- Name: $v - Name: $v
Entry: 7 Entry: 7
Data: 12|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor Data: 8|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField - Name: <Name>k__BackingField
Entry: 1 Entry: 1
Data: countingDown Data: countingDown
- Name: <UserType>k__BackingField - Name: <UserType>k__BackingField
Entry: 7 Entry: 7
Data: 13|System.RuntimeType, mscorlib Data: 9|System.RuntimeType, mscorlib
- Name: - Name:
Entry: 1 Entry: 1
Data: System.Boolean, mscorlib Data: System.Boolean, mscorlib
@@ -235,7 +175,7 @@ MonoBehaviour:
Data: Data:
- Name: <SystemType>k__BackingField - Name: <SystemType>k__BackingField
Entry: 9 Entry: 9
Data: 13 Data: 9
- Name: <SyncMode>k__BackingField - Name: <SyncMode>k__BackingField
Entry: 7 Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -250,7 +190,7 @@ MonoBehaviour:
Data: false Data: false
- Name: _fieldAttributes - Name: _fieldAttributes
Entry: 7 Entry: 7
Data: 14|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib Data: 10|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name: - Name:
Entry: 12 Entry: 12
Data: 0 Data: 0

View File

@@ -1,9 +1,11 @@
using UnityEngine; namespace Marro.PacManUdon
namespace Marro.PacManUdon
{ {
[RequireComponent(typeof(Animator))] using UdonSharp;
public class ScoreBonusDisplay : SyncedObject using UnityEngine;
using VRC.SDKBase;
using VRC.Udon;
public class ScoreBonusDisplay : UdonSharpBehaviour
{ {
private Animator animator; private Animator animator;
private float countdownSeconds; private float countdownSeconds;
@@ -16,11 +18,11 @@ namespace Marro.PacManUdon
gameObject.SetActive(false); gameObject.SetActive(false);
} }
public override void SyncedUpdate() void Update()
{ {
if (countingDown) if (countingDown)
{ {
countdownSeconds -= networkManager.SyncedDeltaTime; countdownSeconds -= Time.deltaTime;
if (countdownSeconds <= 0) if (countdownSeconds <= 0)
{ {
Hide(); Hide();
@@ -46,15 +48,5 @@ namespace Marro.PacManUdon
countingDown = false; countingDown = false;
gameObject.SetActive(false); gameObject.SetActive(false);
} }
public override void CollectSyncedData(byte[] data, ref int index, NetworkEventType eventType)
{
}
public override bool WriteSyncedData(byte[] data, ref int index, NetworkEventType eventType)
{
return true;
}
} }
} }

View File

@@ -92,7 +92,7 @@ namespace Marro.PacManUdon
pacMan.SetPosition(attractScreenElements[16].transform.localPosition); pacMan.SetPosition(attractScreenElements[16].transform.localPosition);
pacMan.SetDirection(Vector2.left); pacMan.SetDirection(Vector2.left);
ghostManager.RestartLevel(); ghostManager.Reset();
ghostManager.SetLevel(2); ghostManager.SetLevel(2);
ghostManager.SetKinematic(true); ghostManager.SetKinematic(true);
ghostManager.SetActive(true); ghostManager.SetActive(true);

View File

@@ -19,7 +19,6 @@ namespace Marro.PacManUdon
case 1: case 1:
// Show pole // Show pole
SetIntermissionScreenVisible(true); SetIntermissionScreenVisible(true);
intermission2Pole.SetActive(true);
intermission2Pole.Reset(); intermission2Pole.Reset();
break; break;
case 2: case 2:

View File

@@ -13,7 +13,7 @@ namespace Marro.PacManUdon
break; break;
case 1: case 1:
// Make maze visible // Make maze visible
RestartLevel(afterLifeLost: true); RestartLevel();
SetMazeVisible(true); SetMazeVisible(true);
break; break;
case 2: case 2:
@@ -42,7 +42,7 @@ namespace Marro.PacManUdon
SetFrozen(false); SetFrozen(false);
soundManager.SuppressSound(false); soundManager.SuppressSound(false);
soundManager.StartGhostSound(); soundManager.StartGhostSound();
soundManager.UpdatePelletCount(pelletManager.PelletCount - pelletManager.PelletCollectedCount); soundManager.UpdatePelletCount(pelletCountRemaining);
} }
} }
} }

View File

@@ -1,3 +1,5 @@
using UnityEngine;
namespace Marro.PacManUdon namespace Marro.PacManUdon
{ {
public partial class GameManager public partial class GameManager

View File

@@ -18,7 +18,6 @@ namespace Marro.PacManUdon
// Increment level, show ready, show pellets, show lives indicators // Increment level, show ready, show pellets, show lives indicators
IncrementLevel(); IncrementLevel();
statusDisplay.SetExtraLivesDisplayVisible(true); statusDisplay.SetExtraLivesDisplayVisible(true);
statusDisplay.SetLevelDisplayVisible(true);
statusDisplay.SetReadyTextVisible(true); statusDisplay.SetReadyTextVisible(true);
SetPelletsActive(true); SetPelletsActive(true);
break; break;

View File

@@ -1,4 +1,7 @@
using UdonSharp;
using UnityEngine; using UnityEngine;
using VRC.SDKBase;
using VRC.SDK3.Data;
namespace Marro.PacManUdon namespace Marro.PacManUdon
{ {
@@ -9,10 +12,10 @@ namespace Marro.PacManUdon
// While I'm not a big fan of the partial class solution that I ended up doing (static classes would still be neater, or perhaps separate UdonSharpBehaviour instances), // While I'm not a big fan of the partial class solution that I ended up doing (static classes would still be neater, or perhaps separate UdonSharpBehaviour instances),
// I'm not redoing this unless I get instantiatable classes before I wrap up this project. // I'm not redoing this unless I get instantiatable classes before I wrap up this project.
bool currentlyInTimeSequence; bool currentlyInTimeSequence;
bool waitingForTimeSequenceFinalize; bool waitingForTimeSequenceFinish;
bool jumpingToTimeSequence; bool jumpingToTimeSequence;
PacManTimeSequence currentTimeSequence; PacManTimeSequence currentTimeSequence;
float timeSequenceSecondsPassed; [UdonSynced] float timeSequenceSecondsPassed;
int timeSequenceProgress; int timeSequenceProgress;
float[] timeSequenceKeyframeTimes; float[] timeSequenceKeyframeTimes;
@@ -39,8 +42,6 @@ namespace Marro.PacManUdon
{ {
jumpingToTimeSequence = true; jumpingToTimeSequence = true;
TimeSequenceProgressToTime(100000f); TimeSequenceProgressToTime(100000f);
Debug.LogWarning($"{gameObject} TimeSequenceEndCurrent");
TryFinalizeTimeSequence();
jumpingToTimeSequence = false; jumpingToTimeSequence = false;
} }
@@ -56,7 +57,7 @@ namespace Marro.PacManUdon
private void TimeSequenceSkipToNextStep() private void TimeSequenceSkipToNextStep()
{ {
Debug.Log($"{gameObject} TimeSequenceSkipToNextStep"); // Debug.Log($"{gameObject} TimeSequenceSkipToNextStep");
if (timeSequenceProgress < timeSequenceKeyframeTimes.Length) if (timeSequenceProgress < timeSequenceKeyframeTimes.Length)
{ {
TimeSequenceProgressToTime(timeSequenceKeyframeTimes[timeSequenceProgress]); TimeSequenceProgressToTime(timeSequenceKeyframeTimes[timeSequenceProgress]);
@@ -87,53 +88,20 @@ namespace Marro.PacManUdon
private void TimeSequencePrepareForFinish(PacManTimeSequence timeSequence) private void TimeSequencePrepareForFinish(PacManTimeSequence timeSequence)
{ {
//if (networkManager.IsOwner) if (Networking.IsOwner(gameObject))
//{ {
Debug.LogWarning($"{gameObject} TimeSequencePrepareForFinish");
TimeSequenceExecuteFinalize(timeSequence); TimeSequenceExecuteFinalize(timeSequence);
if (!jumpingToTimeSequence) if (!jumpingToTimeSequence)
{ {
TimeSequenceExecuteFinished(timeSequence); TimeSequenceExecuteFinished(timeSequence);
} }
//}
//else
//{
// waitingForTimeSequenceFinalize = true;
//}
} }
else
private void TryFinalizeTimeSequence()
{ {
if (!waitingForTimeSequenceFinalize) waitingForTimeSequenceFinish = true;
{
return;
} }
TimeSequenceExecuteFinalize(currentTimeSequence);
waitingForTimeSequenceFinalize = false;
} }
//private void TimeSequenceSyncWithRemote(bool currentlyInTimeSequence, PacManTimeSequence currentTimeSequence, float timeSequenceSecondsPassed)
//{
// // If the remote is in a time sequence but we're not, or we're in a different time sequence, jump to the remote's time sequence.
// if (currentlyInTimeSequence && (!this.currentlyInTimeSequence || currentTimeSequence != this.currentTimeSequence))
// {
// StartTimeSequence(currentTimeSequence);
// }
// // If we're (now) in a time sequence, jump our progress to match the one on the remote
// if (this.currentlyInTimeSequence)
// {
// TimeSequenceProgressToTime(timeSequenceSecondsPassed);
// }
// // If the remote has finished it's time sequence and we have one waiting to be finalized, we can do so now
// if (!currentlyInTimeSequence)
// {
// TryFinalizeTimeSequence();
// }
//}
#region Events #region Events
public void JumpToTimeSequenceAttractScreenIntroduction() public void JumpToTimeSequenceAttractScreenIntroduction()
@@ -244,7 +212,7 @@ namespace Marro.PacManUdon
private void TimeSequenceExecuteStep(PacManTimeSequence timeSequence, int sequenceProgress) private void TimeSequenceExecuteStep(PacManTimeSequence timeSequence, int sequenceProgress)
{ {
Debug.Log($"{gameObject} Triggered time sequence step for sequence {currentTimeSequence} with progress {sequenceProgress}"); // Debug.Log($"{gameObject} Triggered time sequence step for sequence {currentTimeSequence} with progress {sequenceProgress}");
switch (timeSequence) switch (timeSequence)
{ {
default: default:
@@ -298,7 +266,7 @@ namespace Marro.PacManUdon
private void TimeSequenceExecuteFinalize(PacManTimeSequence timeSequence) private void TimeSequenceExecuteFinalize(PacManTimeSequence timeSequence)
{ {
Debug.Log($"{gameObject} Triggered time sequence finalize for sequence {currentTimeSequence}"); // Debug.Log($"{gameObject} Triggered time sequence step for sequence {currentTimeSequence} with progress {sequenceProgress}");
switch (timeSequence) switch (timeSequence)
{ {
default: default:
@@ -342,7 +310,7 @@ namespace Marro.PacManUdon
private void TimeSequenceExecuteFinished(PacManTimeSequence timeSequence) private void TimeSequenceExecuteFinished(PacManTimeSequence timeSequence)
{ {
Debug.Log($"{gameObject} Triggered time sequence finished for sequence {currentTimeSequence}"); // Debug.Log($"{gameObject} Triggered time sequence step for sequence {currentTimeSequence} with progress {sequenceProgress}");
switch (timeSequence) switch (timeSequence)
{ {
default: default:
@@ -446,5 +414,16 @@ namespace Marro.PacManUdon
} }
#endregion #endregion
public int TimeSequenceProgress
{
get => timeSequenceProgress;
}
public float TimeSequenceSecondsPassed
{
get => timeSequenceSecondsPassed;
set => TimeSequenceProgressToTime(value);
}
} }
} }

File diff suppressed because it is too large Load Diff

View File

@@ -1,11 +1,10 @@
 
using Marro.PacManUdon;
using UdonSharp; using UdonSharp;
using UnityEngine; using UnityEngine;
using VRC.SDKBase; using VRC.SDKBase;
using VRC.Udon; using VRC.Udon;
public class SoundManager : SyncedObject public class SoundManager : UdonSharpBehaviour
{ {
[SerializeField] private AudioSource audioSourcePacMan; [SerializeField] private AudioSource audioSourcePacMan;
[SerializeField] private AudioSource audioSourceGhosts; [SerializeField] private AudioSource audioSourceGhosts;
@@ -253,14 +252,4 @@ public class SoundManager : SyncedObject
return siren0; return siren0;
}; };
} }
public override void CollectSyncedData(byte[] data, ref int index, NetworkEventType eventType)
{
}
public override bool WriteSyncedData(byte[] data, ref int index, NetworkEventType eventType)
{
return true;
}
} }

View File

@@ -49,31 +49,25 @@ MonoBehaviour:
Data: Data:
- Name: $k - Name: $k
Entry: 1 Entry: 1
Data: networkManager Data: scoreDisplayGroup
- Name: $v - Name: $v
Entry: 7 Entry: 7
Data: 2|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor Data: 2|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField - Name: <Name>k__BackingField
Entry: 1 Entry: 1
Data: networkManager Data: scoreDisplayGroup
- Name: <UserType>k__BackingField - Name: <UserType>k__BackingField
Entry: 7 Entry: 7
Data: 3|System.RuntimeType, mscorlib Data: 3|System.RuntimeType, mscorlib
- Name: - Name:
Entry: 1 Entry: 1
Data: Marro.PacManUdon.NetworkManager, Assembly-CSharp Data: UnityEngine.Transform, UnityEngine.CoreModule
- Name: - Name:
Entry: 8 Entry: 8
Data: Data:
- Name: <SystemType>k__BackingField - Name: <SystemType>k__BackingField
Entry: 7 Entry: 9
Data: 4|System.RuntimeType, mscorlib Data: 3
- Name:
Entry: 1
Data: VRC.Udon.UdonBehaviour, VRC.Udon
- Name:
Entry: 8
Data:
- Name: <SyncMode>k__BackingField - Name: <SyncMode>k__BackingField
Entry: 7 Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -88,10 +82,16 @@ MonoBehaviour:
Data: true Data: true
- Name: _fieldAttributes - Name: _fieldAttributes
Entry: 7 Entry: 7
Data: 5|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib Data: 4|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name: - Name:
Entry: 12 Entry: 12
Data: 0 Data: 1
- Name:
Entry: 7
Data: 5|UnityEngine.SerializeField, UnityEngine.CoreModule
- Name:
Entry: 8
Data:
- Name: - Name:
Entry: 13 Entry: 13
Data: Data:
@@ -109,19 +109,19 @@ MonoBehaviour:
Data: Data:
- Name: $k - Name: $k
Entry: 1 Entry: 1
Data: scoreDisplayGroup Data: label1UPText
- Name: $v - Name: $v
Entry: 7 Entry: 7
Data: 6|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor Data: 6|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField - Name: <Name>k__BackingField
Entry: 1 Entry: 1
Data: scoreDisplayGroup Data: label1UPText
- Name: <UserType>k__BackingField - Name: <UserType>k__BackingField
Entry: 7 Entry: 7
Data: 7|System.RuntimeType, mscorlib Data: 7|System.RuntimeType, mscorlib
- Name: - Name:
Entry: 1 Entry: 1
Data: UnityEngine.Transform, UnityEngine.CoreModule Data: TMPro.TMP_Text, Unity.TextMeshPro
- Name: - Name:
Entry: 8 Entry: 8
Data: Data:
@@ -169,25 +169,19 @@ MonoBehaviour:
Data: Data:
- Name: $k - Name: $k
Entry: 1 Entry: 1
Data: label1UPText Data: score1UPText
- Name: $v - Name: $v
Entry: 7 Entry: 7
Data: 10|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor Data: 10|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField - Name: <Name>k__BackingField
Entry: 1 Entry: 1
Data: label1UPText Data: score1UPText
- Name: <UserType>k__BackingField - Name: <UserType>k__BackingField
Entry: 7 Entry: 9
Data: 11|System.RuntimeType, mscorlib Data: 7
- Name:
Entry: 1
Data: TMPro.TMP_Text, Unity.TextMeshPro
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField - Name: <SystemType>k__BackingField
Entry: 9 Entry: 9
Data: 11 Data: 7
- Name: <SyncMode>k__BackingField - Name: <SyncMode>k__BackingField
Entry: 7 Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -202,67 +196,13 @@ MonoBehaviour:
Data: true Data: true
- Name: _fieldAttributes - Name: _fieldAttributes
Entry: 7 Entry: 7
Data: 12|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib Data: 11|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name: - Name:
Entry: 12 Entry: 12
Data: 1 Data: 1
- Name: - Name:
Entry: 7 Entry: 7
Data: 13|UnityEngine.SerializeField, UnityEngine.CoreModule Data: 12|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: 7
Data:
- Name: $k
Entry: 1
Data: score1UPText
- Name: $v
Entry: 7
Data: 14|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: score1UPText
- 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: true
- Name: _fieldAttributes
Entry: 7
Data: 15|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 1
- Name:
Entry: 7
Data: 16|UnityEngine.SerializeField, UnityEngine.CoreModule
- Name: - Name:
Entry: 8 Entry: 8
Data: Data:
@@ -286,16 +226,16 @@ MonoBehaviour:
Data: labelHighScoreText Data: labelHighScoreText
- Name: $v - Name: $v
Entry: 7 Entry: 7
Data: 17|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor Data: 13|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField - Name: <Name>k__BackingField
Entry: 1 Entry: 1
Data: labelHighScoreText Data: labelHighScoreText
- Name: <UserType>k__BackingField - Name: <UserType>k__BackingField
Entry: 9 Entry: 9
Data: 11 Data: 7
- Name: <SystemType>k__BackingField - Name: <SystemType>k__BackingField
Entry: 9 Entry: 9
Data: 11 Data: 7
- Name: <SyncMode>k__BackingField - Name: <SyncMode>k__BackingField
Entry: 7 Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -310,13 +250,13 @@ MonoBehaviour:
Data: true Data: true
- Name: _fieldAttributes - Name: _fieldAttributes
Entry: 7 Entry: 7
Data: 18|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib Data: 14|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name: - Name:
Entry: 12 Entry: 12
Data: 1 Data: 1
- Name: - Name:
Entry: 7 Entry: 7
Data: 19|UnityEngine.SerializeField, UnityEngine.CoreModule Data: 15|UnityEngine.SerializeField, UnityEngine.CoreModule
- Name: - Name:
Entry: 8 Entry: 8
Data: Data:
@@ -340,16 +280,16 @@ MonoBehaviour:
Data: scoreHighScoreText Data: scoreHighScoreText
- Name: $v - Name: $v
Entry: 7 Entry: 7
Data: 20|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor Data: 16|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField - Name: <Name>k__BackingField
Entry: 1 Entry: 1
Data: scoreHighScoreText Data: scoreHighScoreText
- Name: <UserType>k__BackingField - Name: <UserType>k__BackingField
Entry: 9 Entry: 9
Data: 11 Data: 7
- Name: <SystemType>k__BackingField - Name: <SystemType>k__BackingField
Entry: 9 Entry: 9
Data: 11 Data: 7
- Name: <SyncMode>k__BackingField - Name: <SyncMode>k__BackingField
Entry: 7 Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -364,13 +304,13 @@ MonoBehaviour:
Data: true Data: true
- Name: _fieldAttributes - Name: _fieldAttributes
Entry: 7 Entry: 7
Data: 21|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib Data: 17|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name: - Name:
Entry: 12 Entry: 12
Data: 1 Data: 1
- Name: - Name:
Entry: 7 Entry: 7
Data: 22|UnityEngine.SerializeField, UnityEngine.CoreModule Data: 18|UnityEngine.SerializeField, UnityEngine.CoreModule
- Name: - Name:
Entry: 8 Entry: 8
Data: Data:
@@ -394,16 +334,16 @@ MonoBehaviour:
Data: debugText Data: debugText
- Name: $v - Name: $v
Entry: 7 Entry: 7
Data: 23|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor Data: 19|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField - Name: <Name>k__BackingField
Entry: 1 Entry: 1
Data: debugText Data: debugText
- Name: <UserType>k__BackingField - Name: <UserType>k__BackingField
Entry: 9 Entry: 9
Data: 11 Data: 7
- Name: <SystemType>k__BackingField - Name: <SystemType>k__BackingField
Entry: 9 Entry: 9
Data: 11 Data: 7
- Name: <SyncMode>k__BackingField - Name: <SyncMode>k__BackingField
Entry: 7 Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -418,13 +358,13 @@ MonoBehaviour:
Data: true Data: true
- Name: _fieldAttributes - Name: _fieldAttributes
Entry: 7 Entry: 7
Data: 24|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib Data: 20|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name: - Name:
Entry: 12 Entry: 12
Data: 1 Data: 1
- Name: - Name:
Entry: 7 Entry: 7
Data: 25|UnityEngine.SerializeField, UnityEngine.CoreModule Data: 21|UnityEngine.SerializeField, UnityEngine.CoreModule
- Name: - Name:
Entry: 8 Entry: 8
Data: Data:
@@ -448,16 +388,16 @@ MonoBehaviour:
Data: debugText2 Data: debugText2
- Name: $v - Name: $v
Entry: 7 Entry: 7
Data: 26|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor Data: 22|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField - Name: <Name>k__BackingField
Entry: 1 Entry: 1
Data: debugText2 Data: debugText2
- Name: <UserType>k__BackingField - Name: <UserType>k__BackingField
Entry: 9 Entry: 9
Data: 11 Data: 7
- Name: <SystemType>k__BackingField - Name: <SystemType>k__BackingField
Entry: 9 Entry: 9
Data: 11 Data: 7
- Name: <SyncMode>k__BackingField - Name: <SyncMode>k__BackingField
Entry: 7 Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -472,13 +412,13 @@ MonoBehaviour:
Data: true Data: true
- Name: _fieldAttributes - Name: _fieldAttributes
Entry: 7 Entry: 7
Data: 27|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib Data: 23|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name: - Name:
Entry: 12 Entry: 12
Data: 1 Data: 1
- Name: - Name:
Entry: 7 Entry: 7
Data: 28|UnityEngine.SerializeField, UnityEngine.CoreModule Data: 24|UnityEngine.SerializeField, UnityEngine.CoreModule
- Name: - Name:
Entry: 8 Entry: 8
Data: Data:
@@ -502,16 +442,16 @@ MonoBehaviour:
Data: gameOverText Data: gameOverText
- Name: $v - Name: $v
Entry: 7 Entry: 7
Data: 29|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor Data: 25|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField - Name: <Name>k__BackingField
Entry: 1 Entry: 1
Data: gameOverText Data: gameOverText
- Name: <UserType>k__BackingField - Name: <UserType>k__BackingField
Entry: 9 Entry: 9
Data: 11 Data: 7
- Name: <SystemType>k__BackingField - Name: <SystemType>k__BackingField
Entry: 9 Entry: 9
Data: 11 Data: 7
- Name: <SyncMode>k__BackingField - Name: <SyncMode>k__BackingField
Entry: 7 Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -526,13 +466,13 @@ MonoBehaviour:
Data: true Data: true
- Name: _fieldAttributes - Name: _fieldAttributes
Entry: 7 Entry: 7
Data: 30|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib Data: 26|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name: - Name:
Entry: 12 Entry: 12
Data: 1 Data: 1
- Name: - Name:
Entry: 7 Entry: 7
Data: 31|UnityEngine.SerializeField, UnityEngine.CoreModule Data: 27|UnityEngine.SerializeField, UnityEngine.CoreModule
- Name: - Name:
Entry: 8 Entry: 8
Data: Data:
@@ -556,16 +496,16 @@ MonoBehaviour:
Data: player1Text Data: player1Text
- Name: $v - Name: $v
Entry: 7 Entry: 7
Data: 32|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor Data: 28|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField - Name: <Name>k__BackingField
Entry: 1 Entry: 1
Data: player1Text Data: player1Text
- Name: <UserType>k__BackingField - Name: <UserType>k__BackingField
Entry: 9 Entry: 9
Data: 11 Data: 7
- Name: <SystemType>k__BackingField - Name: <SystemType>k__BackingField
Entry: 9 Entry: 9
Data: 11 Data: 7
- Name: <SyncMode>k__BackingField - Name: <SyncMode>k__BackingField
Entry: 7 Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -580,13 +520,13 @@ MonoBehaviour:
Data: true Data: true
- Name: _fieldAttributes - Name: _fieldAttributes
Entry: 7 Entry: 7
Data: 33|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib Data: 29|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name: - Name:
Entry: 12 Entry: 12
Data: 1 Data: 1
- Name: - Name:
Entry: 7 Entry: 7
Data: 34|UnityEngine.SerializeField, UnityEngine.CoreModule Data: 30|UnityEngine.SerializeField, UnityEngine.CoreModule
- Name: - Name:
Entry: 8 Entry: 8
Data: Data:
@@ -610,16 +550,16 @@ MonoBehaviour:
Data: readyText Data: readyText
- Name: $v - Name: $v
Entry: 7 Entry: 7
Data: 35|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor Data: 31|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField - Name: <Name>k__BackingField
Entry: 1 Entry: 1
Data: readyText Data: readyText
- Name: <UserType>k__BackingField - Name: <UserType>k__BackingField
Entry: 9 Entry: 9
Data: 11 Data: 7
- Name: <SystemType>k__BackingField - Name: <SystemType>k__BackingField
Entry: 9 Entry: 9
Data: 11 Data: 7
- Name: <SyncMode>k__BackingField - Name: <SyncMode>k__BackingField
Entry: 7 Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -634,13 +574,13 @@ MonoBehaviour:
Data: true Data: true
- Name: _fieldAttributes - Name: _fieldAttributes
Entry: 7 Entry: 7
Data: 36|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib Data: 32|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name: - Name:
Entry: 12 Entry: 12
Data: 1 Data: 1
- Name: - Name:
Entry: 7 Entry: 7
Data: 37|UnityEngine.SerializeField, UnityEngine.CoreModule Data: 33|UnityEngine.SerializeField, UnityEngine.CoreModule
- Name: - Name:
Entry: 8 Entry: 8
Data: Data:
@@ -664,16 +604,16 @@ MonoBehaviour:
Data: levelDisplayDigitsContainer Data: levelDisplayDigitsContainer
- Name: $v - Name: $v
Entry: 7 Entry: 7
Data: 38|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor Data: 34|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField - Name: <Name>k__BackingField
Entry: 1 Entry: 1
Data: levelDisplayDigitsContainer Data: levelDisplayDigitsContainer
- Name: <UserType>k__BackingField - Name: <UserType>k__BackingField
Entry: 9 Entry: 9
Data: 7 Data: 3
- Name: <SystemType>k__BackingField - Name: <SystemType>k__BackingField
Entry: 9 Entry: 9
Data: 7 Data: 3
- Name: <SyncMode>k__BackingField - Name: <SyncMode>k__BackingField
Entry: 7 Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -688,13 +628,13 @@ MonoBehaviour:
Data: true Data: true
- Name: _fieldAttributes - Name: _fieldAttributes
Entry: 7 Entry: 7
Data: 39|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib Data: 35|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name: - Name:
Entry: 12 Entry: 12
Data: 1 Data: 1
- Name: - Name:
Entry: 7 Entry: 7
Data: 40|UnityEngine.SerializeField, UnityEngine.CoreModule Data: 36|UnityEngine.SerializeField, UnityEngine.CoreModule
- Name: - Name:
Entry: 8 Entry: 8
Data: Data:
@@ -718,16 +658,16 @@ MonoBehaviour:
Data: extraLifeIndicatorsContainer Data: extraLifeIndicatorsContainer
- Name: $v - Name: $v
Entry: 7 Entry: 7
Data: 41|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor Data: 37|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField - Name: <Name>k__BackingField
Entry: 1 Entry: 1
Data: extraLifeIndicatorsContainer Data: extraLifeIndicatorsContainer
- Name: <UserType>k__BackingField - Name: <UserType>k__BackingField
Entry: 9 Entry: 9
Data: 7 Data: 3
- Name: <SystemType>k__BackingField - Name: <SystemType>k__BackingField
Entry: 9 Entry: 9
Data: 7 Data: 3
- Name: <SyncMode>k__BackingField - Name: <SyncMode>k__BackingField
Entry: 7 Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -742,13 +682,13 @@ MonoBehaviour:
Data: true Data: true
- Name: _fieldAttributes - Name: _fieldAttributes
Entry: 7 Entry: 7
Data: 42|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib Data: 38|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name: - Name:
Entry: 12 Entry: 12
Data: 1 Data: 1
- Name: - Name:
Entry: 7 Entry: 7
Data: 43|UnityEngine.SerializeField, UnityEngine.CoreModule Data: 39|UnityEngine.SerializeField, UnityEngine.CoreModule
- Name: - Name:
Entry: 8 Entry: 8
Data: Data:
@@ -772,13 +712,13 @@ MonoBehaviour:
Data: levelDisplayDigitAnimators Data: levelDisplayDigitAnimators
- Name: $v - Name: $v
Entry: 7 Entry: 7
Data: 44|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor Data: 40|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField - Name: <Name>k__BackingField
Entry: 1 Entry: 1
Data: levelDisplayDigitAnimators Data: levelDisplayDigitAnimators
- Name: <UserType>k__BackingField - Name: <UserType>k__BackingField
Entry: 7 Entry: 7
Data: 45|System.RuntimeType, mscorlib Data: 41|System.RuntimeType, mscorlib
- Name: - Name:
Entry: 1 Entry: 1
Data: UnityEngine.Animator[], UnityEngine.AnimationModule Data: UnityEngine.Animator[], UnityEngine.AnimationModule
@@ -787,7 +727,7 @@ MonoBehaviour:
Data: Data:
- Name: <SystemType>k__BackingField - Name: <SystemType>k__BackingField
Entry: 9 Entry: 9
Data: 45 Data: 41
- Name: <SyncMode>k__BackingField - Name: <SyncMode>k__BackingField
Entry: 7 Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -802,7 +742,7 @@ MonoBehaviour:
Data: false Data: false
- Name: _fieldAttributes - Name: _fieldAttributes
Entry: 7 Entry: 7
Data: 46|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib Data: 42|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name: - Name:
Entry: 12 Entry: 12
Data: 0 Data: 0
@@ -826,13 +766,13 @@ MonoBehaviour:
Data: levelDisplayDigitRenderers Data: levelDisplayDigitRenderers
- Name: $v - Name: $v
Entry: 7 Entry: 7
Data: 47|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor Data: 43|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField - Name: <Name>k__BackingField
Entry: 1 Entry: 1
Data: levelDisplayDigitRenderers Data: levelDisplayDigitRenderers
- Name: <UserType>k__BackingField - Name: <UserType>k__BackingField
Entry: 7 Entry: 7
Data: 48|System.RuntimeType, mscorlib Data: 44|System.RuntimeType, mscorlib
- Name: - Name:
Entry: 1 Entry: 1
Data: UnityEngine.Renderer[], UnityEngine.CoreModule Data: UnityEngine.Renderer[], UnityEngine.CoreModule
@@ -841,7 +781,7 @@ MonoBehaviour:
Data: Data:
- Name: <SystemType>k__BackingField - Name: <SystemType>k__BackingField
Entry: 9 Entry: 9
Data: 48 Data: 44
- Name: <SyncMode>k__BackingField - Name: <SyncMode>k__BackingField
Entry: 7 Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -856,7 +796,7 @@ MonoBehaviour:
Data: false Data: false
- Name: _fieldAttributes - Name: _fieldAttributes
Entry: 7 Entry: 7
Data: 49|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib Data: 45|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name: - Name:
Entry: 12 Entry: 12
Data: 0 Data: 0
@@ -880,13 +820,13 @@ MonoBehaviour:
Data: extraLifeIndicators Data: extraLifeIndicators
- Name: $v - Name: $v
Entry: 7 Entry: 7
Data: 50|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor Data: 46|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField - Name: <Name>k__BackingField
Entry: 1 Entry: 1
Data: extraLifeIndicators Data: extraLifeIndicators
- Name: <UserType>k__BackingField - Name: <UserType>k__BackingField
Entry: 7 Entry: 7
Data: 51|System.RuntimeType, mscorlib Data: 47|System.RuntimeType, mscorlib
- Name: - Name:
Entry: 1 Entry: 1
Data: UnityEngine.GameObject[], UnityEngine.CoreModule Data: UnityEngine.GameObject[], UnityEngine.CoreModule
@@ -895,7 +835,7 @@ MonoBehaviour:
Data: Data:
- Name: <SystemType>k__BackingField - Name: <SystemType>k__BackingField
Entry: 9 Entry: 9
Data: 51 Data: 47
- Name: <SyncMode>k__BackingField - Name: <SyncMode>k__BackingField
Entry: 7 Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -910,7 +850,7 @@ MonoBehaviour:
Data: false Data: false
- Name: _fieldAttributes - Name: _fieldAttributes
Entry: 7 Entry: 7
Data: 52|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib Data: 48|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name: - Name:
Entry: 12 Entry: 12
Data: 0 Data: 0
@@ -934,13 +874,13 @@ MonoBehaviour:
Data: label1UPVisible Data: label1UPVisible
- Name: $v - Name: $v
Entry: 7 Entry: 7
Data: 53|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor Data: 49|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField - Name: <Name>k__BackingField
Entry: 1 Entry: 1
Data: label1UPVisible Data: label1UPVisible
- Name: <UserType>k__BackingField - Name: <UserType>k__BackingField
Entry: 7 Entry: 7
Data: 54|System.RuntimeType, mscorlib Data: 50|System.RuntimeType, mscorlib
- Name: - Name:
Entry: 1 Entry: 1
Data: System.Boolean, mscorlib Data: System.Boolean, mscorlib
@@ -949,7 +889,7 @@ MonoBehaviour:
Data: Data:
- Name: <SystemType>k__BackingField - Name: <SystemType>k__BackingField
Entry: 9 Entry: 9
Data: 54 Data: 50
- Name: <SyncMode>k__BackingField - Name: <SyncMode>k__BackingField
Entry: 7 Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -964,7 +904,7 @@ MonoBehaviour:
Data: false Data: false
- Name: _fieldAttributes - Name: _fieldAttributes
Entry: 7 Entry: 7
Data: 55|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib Data: 51|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name: - Name:
Entry: 12 Entry: 12
Data: 0 Data: 0
@@ -988,16 +928,16 @@ MonoBehaviour:
Data: label1UPTextBlinking Data: label1UPTextBlinking
- Name: $v - Name: $v
Entry: 7 Entry: 7
Data: 56|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor Data: 52|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField - Name: <Name>k__BackingField
Entry: 1 Entry: 1
Data: label1UPTextBlinking Data: label1UPTextBlinking
- Name: <UserType>k__BackingField - Name: <UserType>k__BackingField
Entry: 9 Entry: 9
Data: 54 Data: 50
- Name: <SystemType>k__BackingField - Name: <SystemType>k__BackingField
Entry: 9 Entry: 9
Data: 54 Data: 50
- Name: <SyncMode>k__BackingField - Name: <SyncMode>k__BackingField
Entry: 7 Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -1012,7 +952,7 @@ MonoBehaviour:
Data: false Data: false
- Name: _fieldAttributes - Name: _fieldAttributes
Entry: 7 Entry: 7
Data: 57|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib Data: 53|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name: - Name:
Entry: 12 Entry: 12
Data: 0 Data: 0
@@ -1033,16 +973,16 @@ MonoBehaviour:
Data: Data:
- Name: $k - Name: $k
Entry: 1 Entry: 1
Data: labelBlinkTimer Data: labelBlinkToggleInterval
- Name: $v - Name: $v
Entry: 7 Entry: 7
Data: 58|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor Data: 54|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField - Name: <Name>k__BackingField
Entry: 1 Entry: 1
Data: labelBlinkTimer Data: labelBlinkToggleInterval
- Name: <UserType>k__BackingField - Name: <UserType>k__BackingField
Entry: 7 Entry: 7
Data: 59|System.RuntimeType, mscorlib Data: 55|System.RuntimeType, mscorlib
- Name: - Name:
Entry: 1 Entry: 1
Data: System.Single, mscorlib Data: System.Single, mscorlib
@@ -1051,7 +991,7 @@ MonoBehaviour:
Data: Data:
- Name: <SystemType>k__BackingField - Name: <SystemType>k__BackingField
Entry: 9 Entry: 9
Data: 59 Data: 55
- Name: <SyncMode>k__BackingField - Name: <SyncMode>k__BackingField
Entry: 7 Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -1066,7 +1006,55 @@ MonoBehaviour:
Data: false Data: false
- Name: _fieldAttributes - Name: _fieldAttributes
Entry: 7 Entry: 7
Data: 60|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib Data: 56|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: labelBlinkTimer
- Name: $v
Entry: 7
Data: 57|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: labelBlinkTimer
- Name: <UserType>k__BackingField
Entry: 9
Data: 55
- Name: <SystemType>k__BackingField
Entry: 9
Data: 55
- 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: 58|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name: - Name:
Entry: 12 Entry: 12
Data: 0 Data: 0

View File

@@ -1,9 +1,12 @@
using UnityEngine; namespace Marro.PacManUdon
using TMPro;
namespace Marro.PacManUdon
{ {
public class StatusDisplay : SyncedObject using UdonSharp;
using UnityEngine;
using VRC.SDKBase;
using VRC.Udon;
using TMPro;
public class StatusDisplay : UdonSharpBehaviour
{ {
[SerializeField] private Transform scoreDisplayGroup; [SerializeField] private Transform scoreDisplayGroup;
[SerializeField] private TMP_Text label1UPText; [SerializeField] private TMP_Text label1UPText;
@@ -25,7 +28,7 @@ namespace Marro.PacManUdon
private bool label1UPVisible; private bool label1UPVisible;
private bool label1UPTextBlinking; private bool label1UPTextBlinking;
private const float labelBlinkToggleInterval = 0.26666667f; private float labelBlinkToggleInterval = 0.26666667f;
private float labelBlinkTimer; private float labelBlinkTimer;
public void Initialize() public void Initialize()
@@ -50,11 +53,11 @@ namespace Marro.PacManUdon
SetLabel1UPTextBlinking(false); SetLabel1UPTextBlinking(false);
} }
public override void SyncedUpdate() void Update()
{ {
if (label1UPTextBlinking) if (label1UPTextBlinking)
{ {
labelBlinkTimer += networkManager.SyncedDeltaTime; labelBlinkTimer += Time.deltaTime;
if (labelBlinkTimer > labelBlinkToggleInterval) if (labelBlinkTimer > labelBlinkToggleInterval)
{ {
labelBlinkTimer -= labelBlinkToggleInterval; labelBlinkTimer -= labelBlinkToggleInterval;
@@ -166,15 +169,5 @@ namespace Marro.PacManUdon
levelDisplayDigitAnimators[i].SetFloat("FruitType", PacManConstants.FruitTypeToValue(PacManConstants.GetFruitTypeForLevel(level - i))); levelDisplayDigitAnimators[i].SetFloat("FruitType", PacManConstants.FruitTypeToValue(PacManConstants.GetFruitTypeForLevel(level - i)));
} }
} }
public override void CollectSyncedData(byte[] data, ref int index, NetworkEventType eventType)
{
}
public override bool WriteSyncedData(byte[] data, ref int index, NetworkEventType eventType)
{
return true;
}
} }
} }

View File

@@ -1,15 +0,0 @@
using System.Collections;
using UdonSharp;
using UnityEngine;
namespace Marro.PacManUdon
{
public abstract class SyncedObject : UdonSharpBehaviour
{
public NetworkManager networkManager;
public virtual void SyncedUpdate() { }
public abstract void CollectSyncedData(byte[] data, ref int index, NetworkEventType eventType);
public abstract bool WriteSyncedData(byte[] data, ref int index, NetworkEventType eventType);
}
}

View File

@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: d09fe6fd5a83df9468f5ffcb43d73af3
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,14 +0,0 @@
namespace Marro.PacManUdon
{
using UdonSharp;
using UnityEngine;
public class Test : UdonSharpBehaviour
{
[SerializeField] Pellet pellet;
public void Start()
{
Debug.Log(pellet.enabled);
}
}
}

View File

@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 0227a738d77ab0849bdc9047b5b27c78
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,118 +0,0 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: c333ccfdd0cbdbc4ca30cef2dd6e6b9b, type: 3}
m_Name: Test1
m_EditorClassIdentifier:
serializedUdonProgramAsset: {fileID: 11400000, guid: 6457f9f1332ac0742bdff23291631f30, type: 2}
udonAssembly:
assemblyError:
sourceCsScript: {fileID: 11500000, guid: 0227a738d77ab0849bdc9047b5b27c78, type: 3}
scriptVersion: 2
compiledVersion: 2
behaviourSyncMode: 0
hasInteractEvent: 0
scriptID: -4571266787425106669
serializationData:
SerializedFormat: 2
SerializedBytes:
ReferencedUnityObjects: []
SerializedBytesString:
Prefab: {fileID: 0}
PrefabModificationsReferencedUnityObjects: []
PrefabModifications: []
SerializationNodes:
- Name: fieldDefinitions
Entry: 7
Data: 0|System.Collections.Generic.Dictionary`2[[System.String, mscorlib],[UdonSharp.Compiler.FieldDefinition,
UdonSharp.Editor]], mscorlib
- Name: comparer
Entry: 7
Data: 1|System.Collections.Generic.GenericEqualityComparer`1[[System.String,
mscorlib]], mscorlib
- Name:
Entry: 8
Data:
- Name:
Entry: 12
Data: 1
- Name:
Entry: 7
Data:
- Name: $k
Entry: 1
Data: pellet
- Name: $v
Entry: 7
Data: 2|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: pellet
- Name: <UserType>k__BackingField
Entry: 7
Data: 3|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: Marro.PacManUdon.Pellet, Assembly-CSharp
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 7
Data: 4|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: VRC.Udon.UdonBehaviour, VRC.Udon
- Name:
Entry: 8
Data:
- 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: 5|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 1
- Name:
Entry: 7
Data: 6|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:
- Name:
Entry: 8
Data:

View File

@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 184e93443ec1bb24fa4e1db8b51405da
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 1ab80220efbebb2489a3218f3ee9b00b
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,109 +0,0 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!91 &9100000
AnimatorController:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: ColoredTexture
serializedVersion: 5
m_AnimatorParameters:
- m_Name: Color
m_Type: 1
m_DefaultFloat: 0
m_DefaultInt: 0
m_DefaultBool: 0
m_Controller: {fileID: 0}
m_AnimatorLayers:
- serializedVersion: 5
m_Name: Base Layer
m_StateMachine: {fileID: 2235177317997810699}
m_Mask: {fileID: 0}
m_Motions: []
m_Behaviours: []
m_BlendingMode: 0
m_SyncedLayerIndex: -1
m_DefaultWeight: 0
m_IKPass: 0
m_SyncedLayerAffectsTiming: 0
m_Controller: {fileID: 9100000}
--- !u!1107 &2235177317997810699
AnimatorStateMachine:
serializedVersion: 6
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Base Layer
m_ChildStates:
- serializedVersion: 1
m_State: {fileID: 6251436573727931732}
m_Position: {x: 384.82895, y: 133.70117, z: 0}
m_ChildStateMachines: []
m_AnyStateTransitions: []
m_EntryTransitions: []
m_StateMachineTransitions: {}
m_StateMachineBehaviours: []
m_AnyStatePosition: {x: 50, y: 20, z: 0}
m_EntryPosition: {x: 50, y: 120, z: 0}
m_ExitPosition: {x: 800, y: 120, z: 0}
m_ParentStateMachinePosition: {x: 800, y: 20, z: 0}
m_DefaultState: {fileID: 6251436573727931732}
--- !u!1102 &6251436573727931732
AnimatorState:
serializedVersion: 6
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Blend Tree
m_Speed: 1
m_CycleOffset: 0
m_Transitions: []
m_StateMachineBehaviours: []
m_Position: {x: 50, y: 50, z: 0}
m_IKOnFeet: 0
m_WriteDefaultValues: 1
m_Mirror: 0
m_SpeedParameterActive: 0
m_MirrorParameterActive: 0
m_CycleOffsetParameterActive: 0
m_TimeParameterActive: 0
m_Motion: {fileID: 7315205519034161812}
m_Tag:
m_SpeedParameter:
m_MirrorParameter:
m_CycleOffsetParameter:
m_TimeParameter:
--- !u!206 &7315205519034161812
BlendTree:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Blend Tree
m_Childs:
- serializedVersion: 2
m_Motion: {fileID: 7400000, guid: f06a4450a22bb184bb3881fbc7ddc36f, type: 2}
m_Threshold: 0
m_Position: {x: 0, y: 0}
m_TimeScale: 1
m_CycleOffset: 0
m_DirectBlendParameter: Color
m_Mirror: 0
- serializedVersion: 2
m_Motion: {fileID: 7400000, guid: 152a2df117ac1c948b25f28a386ac289, type: 2}
m_Threshold: 1
m_Position: {x: 0, y: 0}
m_TimeScale: 1
m_CycleOffset: 0
m_DirectBlendParameter: Color
m_Mirror: 0
m_BlendParameter: Color
m_BlendParameterY: Blend
m_MinThreshold: 0
m_MaxThreshold: 1
m_UseAutomaticThresholds: 0
m_NormalizedBlendValues: 0
m_BlendType: 0

View File

@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 72593807222e776478e455c600f7ccf9
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 9100000
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,206 +0,0 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!74 &7400000
AnimationClip:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: GreenTexture
serializedVersion: 7
m_Legacy: 0
m_Compressed: 0
m_UseHighQualityCurve: 1
m_RotationCurves: []
m_CompressedRotationCurves: []
m_EulerCurves: []
m_PositionCurves: []
m_ScaleCurves: []
m_FloatCurves:
- serializedVersion: 2
curve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 0
outSlope: 0
tangentMode: 136
weightedMode: 0
inWeight: 0
outWeight: 0
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
attribute: m_Color.r
path:
classID: 114
script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
flags: 0
- serializedVersion: 2
curve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 1
inSlope: 0
outSlope: 0
tangentMode: 136
weightedMode: 0
inWeight: 0
outWeight: 0
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
attribute: m_Color.g
path:
classID: 114
script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
flags: 0
- serializedVersion: 2
curve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 0
outSlope: 0
tangentMode: 136
weightedMode: 0
inWeight: 0
outWeight: 0
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
attribute: m_Color.b
path:
classID: 114
script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
flags: 0
m_PPtrCurves: []
m_SampleRate: 1
m_WrapMode: 0
m_Bounds:
m_Center: {x: 0, y: 0, z: 0}
m_Extent: {x: 0, y: 0, z: 0}
m_ClipBindingConstant:
genericBindings:
- serializedVersion: 2
path: 0
attribute: 2526845255
script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
typeID: 114
customType: 0
isPPtrCurve: 0
isIntCurve: 0
isSerializeReferenceCurve: 0
- serializedVersion: 2
path: 0
attribute: 4215373228
script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
typeID: 114
customType: 0
isPPtrCurve: 0
isIntCurve: 0
isSerializeReferenceCurve: 0
- serializedVersion: 2
path: 0
attribute: 2334886179
script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
typeID: 114
customType: 0
isPPtrCurve: 0
isIntCurve: 0
isSerializeReferenceCurve: 0
pptrCurveMapping: []
m_AnimationClipSettings:
serializedVersion: 2
m_AdditiveReferencePoseClip: {fileID: 0}
m_AdditiveReferencePoseTime: 0
m_StartTime: 0
m_StopTime: 0
m_OrientationOffsetY: 0
m_Level: 0
m_CycleOffset: 0
m_HasAdditiveReferencePose: 0
m_LoopTime: 0
m_LoopBlend: 0
m_LoopBlendOrientation: 0
m_LoopBlendPositionY: 0
m_LoopBlendPositionXZ: 0
m_KeepOriginalOrientation: 0
m_KeepOriginalPositionY: 1
m_KeepOriginalPositionXZ: 0
m_HeightFromFeet: 0
m_Mirror: 0
m_EditorCurves:
- serializedVersion: 2
curve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 0
outSlope: 0
tangentMode: 136
weightedMode: 0
inWeight: 0
outWeight: 0
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
attribute: m_Color.r
path:
classID: 114
script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
flags: 0
- serializedVersion: 2
curve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 1
inSlope: 0
outSlope: 0
tangentMode: 136
weightedMode: 0
inWeight: 0
outWeight: 0
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
attribute: m_Color.g
path:
classID: 114
script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
flags: 0
- serializedVersion: 2
curve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 0
outSlope: 0
tangentMode: 136
weightedMode: 0
inWeight: 0
outWeight: 0
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
attribute: m_Color.b
path:
classID: 114
script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
flags: 0
m_EulerEditorCurves: []
m_HasGenericRootTransform: 0
m_HasMotionFloatCurves: 0
m_Events: []

View File

@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 152a2df117ac1c948b25f28a386ac289
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 7400000
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,206 +0,0 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!74 &7400000
AnimationClip:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: RedTexture
serializedVersion: 7
m_Legacy: 0
m_Compressed: 0
m_UseHighQualityCurve: 1
m_RotationCurves: []
m_CompressedRotationCurves: []
m_EulerCurves: []
m_PositionCurves: []
m_ScaleCurves: []
m_FloatCurves:
- serializedVersion: 2
curve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 1
inSlope: 0
outSlope: 0
tangentMode: 136
weightedMode: 0
inWeight: 0
outWeight: 0
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
attribute: m_Color.r
path:
classID: 114
script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
flags: 0
- serializedVersion: 2
curve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 0
outSlope: 0
tangentMode: 136
weightedMode: 0
inWeight: 0
outWeight: 0
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
attribute: m_Color.g
path:
classID: 114
script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
flags: 0
- serializedVersion: 2
curve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 0
outSlope: 0
tangentMode: 136
weightedMode: 0
inWeight: 0
outWeight: 0
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
attribute: m_Color.b
path:
classID: 114
script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
flags: 0
m_PPtrCurves: []
m_SampleRate: 1
m_WrapMode: 0
m_Bounds:
m_Center: {x: 0, y: 0, z: 0}
m_Extent: {x: 0, y: 0, z: 0}
m_ClipBindingConstant:
genericBindings:
- serializedVersion: 2
path: 0
attribute: 2526845255
script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
typeID: 114
customType: 0
isPPtrCurve: 0
isIntCurve: 0
isSerializeReferenceCurve: 0
- serializedVersion: 2
path: 0
attribute: 4215373228
script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
typeID: 114
customType: 0
isPPtrCurve: 0
isIntCurve: 0
isSerializeReferenceCurve: 0
- serializedVersion: 2
path: 0
attribute: 2334886179
script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
typeID: 114
customType: 0
isPPtrCurve: 0
isIntCurve: 0
isSerializeReferenceCurve: 0
pptrCurveMapping: []
m_AnimationClipSettings:
serializedVersion: 2
m_AdditiveReferencePoseClip: {fileID: 0}
m_AdditiveReferencePoseTime: 0
m_StartTime: 0
m_StopTime: 0
m_OrientationOffsetY: 0
m_Level: 0
m_CycleOffset: 0
m_HasAdditiveReferencePose: 0
m_LoopTime: 0
m_LoopBlend: 0
m_LoopBlendOrientation: 0
m_LoopBlendPositionY: 0
m_LoopBlendPositionXZ: 0
m_KeepOriginalOrientation: 0
m_KeepOriginalPositionY: 1
m_KeepOriginalPositionXZ: 0
m_HeightFromFeet: 0
m_Mirror: 0
m_EditorCurves:
- serializedVersion: 2
curve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 1
inSlope: 0
outSlope: 0
tangentMode: 136
weightedMode: 0
inWeight: 0
outWeight: 0
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
attribute: m_Color.r
path:
classID: 114
script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
flags: 0
- serializedVersion: 2
curve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 0
outSlope: 0
tangentMode: 136
weightedMode: 0
inWeight: 0
outWeight: 0
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
attribute: m_Color.g
path:
classID: 114
script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
flags: 0
- serializedVersion: 2
curve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 0
outSlope: 0
tangentMode: 136
weightedMode: 0
inWeight: 0
outWeight: 0
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
attribute: m_Color.b
path:
classID: 114
script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
flags: 0
m_EulerEditorCurves: []
m_HasGenericRootTransform: 0
m_HasMotionFloatCurves: 0
m_Events: []

View File

@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: f06a4450a22bb184bb3881fbc7ddc36f
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 7400000
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,544 +0,0 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: c333ccfdd0cbdbc4ca30cef2dd6e6b9b, type: 3}
m_Name: TestBall
m_EditorClassIdentifier:
serializedUdonProgramAsset: {fileID: 11400000, guid: 8968388b0e4fe434fb8da62328c108a0, type: 2}
udonAssembly:
assemblyError:
sourceCsScript: {fileID: 11500000, guid: 0980d82a15346eb45b49fd33db0ffee9, type: 3}
scriptVersion: 2
compiledVersion: 2
behaviourSyncMode: 0
hasInteractEvent: 0
scriptID: -3035274785675086507
serializationData:
SerializedFormat: 2
SerializedBytes:
ReferencedUnityObjects: []
SerializedBytesString:
Prefab: {fileID: 0}
PrefabModificationsReferencedUnityObjects: []
PrefabModifications: []
SerializationNodes:
- Name: fieldDefinitions
Entry: 7
Data: 0|System.Collections.Generic.Dictionary`2[[System.String, mscorlib],[UdonSharp.Compiler.FieldDefinition,
UdonSharp.Editor]], mscorlib
- Name: comparer
Entry: 7
Data: 1|System.Collections.Generic.GenericEqualityComparer`1[[System.String,
mscorlib]], mscorlib
- Name:
Entry: 8
Data:
- Name:
Entry: 12
Data: 9
- Name:
Entry: 7
Data:
- Name: $k
Entry: 1
Data: networkManager
- Name: $v
Entry: 7
Data: 2|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: networkManager
- Name: <UserType>k__BackingField
Entry: 7
Data: 3|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: Marro.PacManUdon.NetworkManager, Assembly-CSharp
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 7
Data: 4|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: VRC.Udon.UdonBehaviour, VRC.Udon
- Name:
Entry: 8
Data:
- 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: 5|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: start
- Name: $v
Entry: 7
Data: 6|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: start
- Name: <UserType>k__BackingField
Entry: 7
Data: 7|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: UnityEngine.Transform, UnityEngine.CoreModule
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 9
Data: 7
- 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: 8|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 1
- Name:
Entry: 7
Data: 9|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: 7
Data:
- Name: $k
Entry: 1
Data: end
- Name: $v
Entry: 7
Data: 10|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: end
- Name: <UserType>k__BackingField
Entry: 9
Data: 7
- Name: <SystemType>k__BackingField
Entry: 9
Data: 7
- 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: 11|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 1
- Name:
Entry: 7
Data: 12|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: 7
Data:
- Name: $k
Entry: 1
Data: mode
- Name: $v
Entry: 7
Data: 13|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: mode
- Name: <UserType>k__BackingField
Entry: 7
Data: 14|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: TestBallMode, Assembly-CSharp
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 7
Data: 15|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: System.Int32, mscorlib
- Name:
Entry: 8
Data:
- 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: 16|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 1
- Name:
Entry: 7
Data: 17|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: 7
Data:
- Name: $k
Entry: 1
Data: sumOfDt
- Name: $v
Entry: 7
Data: 18|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: sumOfDt
- Name: <UserType>k__BackingField
Entry: 7
Data: 19|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: System.Single, mscorlib
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 9
Data: 19
- 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: 20|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: amountUp
- Name: $v
Entry: 7
Data: 21|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: amountUp
- Name: <UserType>k__BackingField
Entry: 9
Data: 19
- Name: <SystemType>k__BackingField
Entry: 9
Data: 19
- 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: 22|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: loopOffset
- Name: $v
Entry: 7
Data: 23|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: loopOffset
- Name: <UserType>k__BackingField
Entry: 9
Data: 19
- Name: <SystemType>k__BackingField
Entry: 9
Data: 19
- 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: 24|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: 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: 15
- Name: <SystemType>k__BackingField
Entry: 9
Data: 15
- 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:
- Name:
Entry: 8
Data:

View File

@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 1845851c6c8f8254baa6b40646c66d59
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,176 +0,0 @@
using librsync.net;
using Marro.PacManUdon;
using System;
using System.Drawing.Text;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
using VRC.SDKBase;
enum TestBallMode
{
UseNetworkTime,
UseNetworkDt,
UseUnityDt,
}
public class TestBall : SyncedObject
{
[SerializeField] private Transform start;
[SerializeField] private Transform end;
[SerializeField] private TestBallMode mode;
private const float LoopTime = 1f;
private const float MaxUp = 0.7f;
private const float UpPerPress = 0.4f;
private const float DownPerSecond = 1f;
private float sumOfDt;
private float amountUp = 0;
private float loopOffset = 0;
private float[] jumps;
private int jumpsIndex;
public void Initialize(NetworkManager networkManager)
{
this.networkManager = networkManager;
sumOfDt = networkManager.SyncedTime;
amountUp = 0;
loopOffset = 0;
jumps = new float[10];
jumpsIndex = 0;
}
public override void SyncedUpdate()
{
SetProgress(GetProgress()); // A quick test that these methods work correctly
DeltaUp(-DownPerSecond * networkManager.SyncedDeltaTime);
UpdateProgress();
float progress = GetProgress();
transform.position = Vector3.Lerp(start.position, end.position, progress) + amountUp * MaxUp * Vector3.up;
}
private void DeltaUp(float delta)
{
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();
loopOffset = (currentTimestamp - progress) * LoopTime;
}
private float GetProgress()
{
var currentTimestamp = GetCurrentTimestamp();
//Debug.Log($"CurrentTimeStamp for mode {mode}: {currentTimestamp}");
return (currentTimestamp - loopOffset) % LoopTime / LoopTime;
}
private float GetCurrentTimestamp()
{
switch (mode)
{
case TestBallMode.UseNetworkTime:
return networkManager.SyncedTime;
case TestBallMode.UseNetworkDt:
case TestBallMode.UseUnityDt:
return sumOfDt;
default:
Debug.LogError($"({nameof(TestBall)}) Unknown mode {mode}!");
return 0;
}
}
private void UpdateProgress()
{
switch (mode)
{
case TestBallMode.UseNetworkDt:
sumOfDt += networkManager.SyncedDeltaTime;
break;
case TestBallMode.UseUnityDt:
if (!networkManager.IsEventUpdate)
{
sumOfDt += Time.fixedDeltaTime;
}
break;
}
}
public void UpButtonPressed()
{
Jump();
Debug.Log($"({nameof(TestBall)}) Up button pressed, jumped up at {GetProgress()} to {amountUp}.");
}
public override void CollectSyncedData(byte[] data, ref int index, NetworkEventType eventType)
{
if (eventType == NetworkEventType.FullSync
|| eventType == NetworkEventType.FullSyncForced)
{
Debug.Log($"({nameof(TestBall)}) Sending sync data at progress {GetProgress()} and amountUp {amountUp}.");
data.Append(amountUp, ref index);
data.Append(GetProgress(), ref index);
}
}
public override bool WriteSyncedData(byte[] data, ref int index, NetworkEventType eventType)
{
if (eventType == NetworkEventType.FullSync
|| eventType == NetworkEventType.FullSyncForced)
{
amountUp = data.ReadFloat(ref index);
SetProgress(data.ReadFloat(ref index));
//Debug.Log($"({nameof(TestBall)}) Received sync event, synced to progress {GetProgress()} and amountUp {amountUp}.");
}
else
{
//Debug.Log($"({nameof(TestBall)}) Received up event, jumped up at {GetProgress()} from {amountUp}.");
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

@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 0980d82a15346eb45b49fd33db0ffee9
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,244 +0,0 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: c333ccfdd0cbdbc4ca30cef2dd6e6b9b, type: 3}
m_Name: TestBallManager
m_EditorClassIdentifier:
serializedUdonProgramAsset: {fileID: 11400000, guid: 007782662b6528e4a855cc8fb5cca273, type: 2}
udonAssembly:
assemblyError:
sourceCsScript: {fileID: 11500000, guid: 40fc654db4dfd4f4c9cdf45903f134a3, type: 3}
scriptVersion: 2
compiledVersion: 2
behaviourSyncMode: 0
hasInteractEvent: 0
scriptID: 8109348476653380640
serializationData:
SerializedFormat: 2
SerializedBytes:
ReferencedUnityObjects: []
SerializedBytesString:
Prefab: {fileID: 0}
PrefabModificationsReferencedUnityObjects: []
PrefabModifications: []
SerializationNodes:
- Name: fieldDefinitions
Entry: 7
Data: 0|System.Collections.Generic.Dictionary`2[[System.String, mscorlib],[UdonSharp.Compiler.FieldDefinition,
UdonSharp.Editor]], mscorlib
- Name: comparer
Entry: 7
Data: 1|System.Collections.Generic.GenericEqualityComparer`1[[System.String,
mscorlib]], mscorlib
- Name:
Entry: 8
Data:
- Name:
Entry: 12
Data: 3
- Name:
Entry: 7
Data:
- Name: $k
Entry: 1
Data: testBalls
- Name: $v
Entry: 7
Data: 2|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: testBalls
- Name: <UserType>k__BackingField
Entry: 7
Data: 3|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: TestBall[], Assembly-CSharp
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 7
Data: 4|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: UnityEngine.Component[], UnityEngine.CoreModule
- Name:
Entry: 8
Data:
- 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: 5|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 1
- Name:
Entry: 7
Data: 6|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: 7
Data:
- Name: $k
Entry: 1
Data: networkManager
- Name: $v
Entry: 7
Data: 7|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: networkManager
- Name: <UserType>k__BackingField
Entry: 7
Data: 8|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: Marro.PacManUdon.NetworkManager, Assembly-CSharp
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 7
Data: 9|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: VRC.Udon.UdonBehaviour, VRC.Udon
- Name:
Entry: 8
Data:
- 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: 10|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 1
- Name:
Entry: 7
Data: 11|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: 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:
- Name:
Entry: 8
Data:

View File

@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 366d931a37811ce47be572127126c17b
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,70 +0,0 @@

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.SendEventSoon(NetworkEventType.PacManTurn);
}
public void SyncButtonPressed()
{
if (VRCPlayerApi.GetPlayerCount() == 1)
{
networkManager.SimulateSyncToTimestamp(networkManager.SyncedTime - 0.5f);
}
else if (networkManager.IsOwner)
{
networkManager.SendEventSoon(NetworkEventType.FullSync);
}
else
{
networkManager.RequestEvent(NetworkEventType.FullSync);
}
}
}

View File

@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 40fc654db4dfd4f4c9cdf45903f134a3
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -18,7 +18,7 @@ PhysicsManager:
m_ClothInterCollisionDistance: 0 m_ClothInterCollisionDistance: 0
m_ClothInterCollisionStiffness: 0 m_ClothInterCollisionStiffness: 0
m_ContactsGeneration: 1 m_ContactsGeneration: 1
m_LayerCollisionMatrix: d7aff7ffd7aff7ffd7aff7ff0800c0ffd7aff7ffc000c0fff7fffffff7ffffffd7aff7ffd709f4ffd709f4ffd7aff7ffc000c0ffd7e9c3ffc020c0ffd7a9f7ffd7a9f7ffd7a9f7ffd78ff7ffc000c0ffd78ff7ffd78ff7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff m_LayerCollisionMatrix: dfaff7ffdfaff7ffdfaff7ffffffffffdfaff7ffc800c0ffffffffffffffffffdfaff7ffdf09f4ffdf09f4ffdfaff7ffc800c0ffdfe9c3ffc820c0ffdfa9f7ffdfa9f7ffdfa9f7ffdf8ff7ffc800c0ffdf8ff7ffdf8ff7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
m_SimulationMode: 0 m_SimulationMode: 0
m_AutoSyncTransforms: 0 m_AutoSyncTransforms: 0
m_ReuseCollisionCallbacks: 1 m_ReuseCollisionCallbacks: 1

View File

@@ -207,6 +207,4 @@ QualitySettings:
excludedTargetPlatforms: excludedTargetPlatforms:
- Standalone - Standalone
m_TextureMipmapLimitGroupNames: [] m_TextureMipmapLimitGroupNames: []
m_PerPlatformDefaultQuality: m_PerPlatformDefaultQuality: {}
Server: 0
Standalone: 0

View File

@@ -8,7 +8,7 @@ TagManager:
- Default - Default
- TransparentFX - TransparentFX
- Ignore Raycast - Ignore Raycast
- Item - reserved3
- Water - Water
- UI - UI
- reserved6 - reserved6
@@ -29,7 +29,7 @@ TagManager:
- reserved4 - reserved4
- MazeWalls - MazeWalls
- GhostStations - GhostStations
- reserved3 -
- -
- -
- -