Initial commit

This commit is contained in:
2025-12-10 21:06:22 +01:00
commit cc9190b9ce
476 changed files with 320218 additions and 0 deletions

View File

@@ -0,0 +1,118 @@
namespace Marro.PacManUdon
{
using UdonSharp;
using UnityEngine;
using VRC.SDK3.Data;
using VRC.SDKBase;
using VRC.Udon;
public class BonusFruit : UdonSharpBehaviour
{
[SerializeField, UdonSynced, FieldChangeCallback(nameof(FruitType))] PacManFruitType fruitType;
Animator animator;
new Renderer renderer;
new Collider collider;
ScoreBonusDisplay scoreBonusDisplay;
[UdonSynced] bool active;
private int value;
private float activeCountdown;
private bool frozen;
public void Initialize()
{
animator = GetComponent<Animator>();
renderer = GetComponent<Renderer>();
collider = GetComponent<Collider>();
scoreBonusDisplay = transform.Find("ScoreBonusDisplay").gameObject.GetComponent<ScoreBonusDisplay>();
scoreBonusDisplay.Initialize();
SetActive(false);
}
void Update()
{
if (active && !frozen)
{
activeCountdown -= Time.deltaTime;
if (activeCountdown <= 0)
{
SetActive(false);
}
}
}
public void Spawn()
{
Debug.Log($"{gameObject} Spawned");
SetActive(true);
activeCountdown = Random.Range(9, 10);
}
public void Despawn()
{
Debug.Log($"{gameObject} Despawned");
SetActive(false);
}
public int Collected()
{
SetActive(false);
scoreBonusDisplay.DisplayTemporarily(value, 1);
return value;
}
public void SetFruitType(PacManFruitType fruitType)
{
this.fruitType = fruitType;
value = (int)fruitScoreValue[PacManConstants.FruitTypeToValue(fruitType)];
animator.SetFloat("FruitType", PacManConstants.FruitTypeToValue(fruitType));
RequestSerialization();
}
public void SetFrozen(bool frozen)
{
this.frozen = frozen;
}
void SetActive(bool active)
{ // This replaces GameObject.active, as attempting to update an animator while a gameobject is inactive seems to result in a silent failure
renderer.enabled = active;
collider.enabled = active;
this.active = active;
RequestSerialization();
}
public PacManFruitType FruitType
{
set
{
SetFruitType(value);
}
get => fruitType;
}
public bool Active
{
set
{
SetActive(value);
}
get => active;
}
private DataDictionary fruitScoreValue = new DataDictionary()
{
{(int)PacManFruitType.None , 0},
{(int)PacManFruitType.Cherries , 100},
{(int)PacManFruitType.Strawberry, 300},
{(int)PacManFruitType.Peach , 500},
{(int)PacManFruitType.Apple , 700},
{(int)PacManFruitType.Grapes , 1000},
{(int)PacManFruitType.Galaxian , 2000},
{(int)PacManFruitType.Bell , 3000},
{(int)PacManFruitType.Key , 5000}
};
}
}

View File

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

View File

@@ -0,0 +1,172 @@
%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: CustomButton
m_EditorClassIdentifier:
serializedUdonProgramAsset: {fileID: 11400000, guid: 3473403fe88c8134e8be431c33461470, type: 2}
udonAssembly:
assemblyError:
sourceCsScript: {fileID: 11500000, guid: 3d9af496212c74a45a7b915169e465af, type: 3}
scriptVersion: 2
compiledVersion: 2
behaviourSyncMode: 0
hasInteractEvent: 1
scriptID: 5707414518806907637
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: 2
- Name:
Entry: 7
Data:
- Name: $k
Entry: 1
Data: customEventReceiver
- Name: $v
Entry: 7
Data: 2|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: customEventReceiver
- Name: <UserType>k__BackingField
Entry: 7
Data: 3|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: VRC.Udon.UdonBehaviour, VRC.Udon
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 9
Data: 3
- 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: 4|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 1
- Name:
Entry: 7
Data: 5|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: eventName
- Name: $v
Entry: 7
Data: 6|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: eventName
- Name: <UserType>k__BackingField
Entry: 7
Data: 7|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: System.String, mscorlib
- 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: 13
Data:
- Name:
Entry: 8
Data:

View File

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

View File

@@ -0,0 +1,17 @@
namespace Marro.PacManUdon
{
using UdonSharp;
using UnityEngine;
using VRC.SDKBase;
using VRC.Udon;
public class CustomButton : UdonSharpBehaviour
{
[SerializeField] private UdonBehaviour customEventReceiver;
[SerializeField] private string eventName;
public override void Interact()
{
customEventReceiver.SendCustomEvent(eventName);
}
}
}

View File

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

View File

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

View File

@@ -0,0 +1,65 @@
using UnityEditor;
using UnityEngine;
public class FixTMPColor : EditorWindow
{
private Color originalColor = new Color(0.667f, 0.667f, 0.667f);
private Color originalColorOutput = new Color(0.667f, 0.667f, 0.667f);
private Color fixedColor = GetFixedTMPColor(new Color(0.667f, 0.667f, 0.667f));
private Color fixedColorOutput = GetFixedTMPColor(new Color(0.667f, 0.667f, 0.667f));
[MenuItem("Tools/Fix TMP Color")]
public static void ShowWindow()
{
GetWindow<FixTMPColor>("Fix TMP Color");
}
private void OnGUI()
{
EditorGUI.HelpBox(GUILayoutUtility.GetRect(50, 50), "Translates between an intended color and a color value which displays as the intended color when used in the TextMeshPro Vertex Color field.", MessageType.Info);
EditorGUILayout.Space();
originalColor = EditorGUILayout.ColorField("Original Color", originalColor);
EditorGUI.DrawRect(GUILayoutUtility.GetRect(50, 50), originalColor);
EditorGUILayout.Space();
fixedColor = EditorGUILayout.ColorField("Fixed TMP Vertex Color", fixedColor);
EditorGUI.DrawRect(GUILayoutUtility.GetRect(50, 50), fixedColor);
if (GUI.changed)
{
if (fixedColorOutput != fixedColor)
{
originalColor = GetOriginalTMPColor(fixedColor);
}
else if (originalColorOutput != originalColor)
{
fixedColor = GetFixedTMPColor(originalColor);
}
originalColorOutput = originalColor;
fixedColorOutput = fixedColor;
}
}
private static Color GetFixedTMPColor(Color input)
{
return new Color(
Mathf.Pow(input.r, 1 / 0.4545f),
Mathf.Pow(input.g, 1 / 0.4545f),
Mathf.Pow(input.b, 1 / 0.4545f),
input.a // Not sure what to do with the alpha channel, leaving it unchanged
);
}
private static Color GetOriginalTMPColor(Color input)
{
return new Color(
Mathf.Pow(input.r, 0.4545f),
Mathf.Pow(input.g, 0.4545f),
Mathf.Pow(input.b, 0.4545f),
input.a // Not sure what to do with the alpha channel, leaving it unchanged
);
}
}

View File

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

View File

@@ -0,0 +1,62 @@
using UnityEngine;
using UnityEditor;
using System.Collections.Generic;
public class ResetParentTransform : EditorWindow
{
[MenuItem("Tools/Reset Parent Transform")]
public static void ShowWindow()
{
GetWindow<ResetParentTransform>("Reset Parent Transform");
}
private void OnGUI()
{
GUILayout.Label("Reset Parent Transform", EditorStyles.boldLabel);
if (GUILayout.Button("Reset Transform for Selected Parent and Adjust Children"))
{
ResetTransform();
}
}
private void ResetTransform()
{
if (Selection.activeGameObject == null)
{
Debug.LogWarning("No GameObject selected. Please select a GameObject in the hierarchy.");
return;
}
Transform parentTransform = Selection.activeGameObject.transform;
if (parentTransform.childCount == 0)
{
Debug.LogWarning("Selected GameObject has no children. Operation aborted.");
return;
}
List<Transform> children = new List<Transform>();
foreach (Transform child in parentTransform)
{
children.Add(child);
}
foreach (Transform child in children)
{
child.transform.parent = null;
}
// Reset the parent's transform to default values
parentTransform.localPosition = Vector3.zero;
parentTransform.localRotation = Quaternion.identity;
parentTransform.localScale = Vector3.one;
foreach (Transform child in children)
{
child.transform.parent = parentTransform;
}
Debug.Log("Parent transform reset and children adjusted.");
}
}

View File

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

View File

@@ -0,0 +1,56 @@
using UnityEngine;
using UnityEditor;
public class SwapYAndZCoordinates : EditorWindow
{
[MenuItem("Tools/Swap Y and Z Coordinates")]
public static void ShowWindow()
{
GetWindow<SwapYAndZCoordinates>("Swap Y and Z Coordinates");
}
private void OnGUI()
{
GUILayout.Label("Swap Y and Z Coordinates", EditorStyles.boldLabel);
if (GUILayout.Button("Swap Y and Z for Selected Object and Children"))
{
SwapCoordinates();
}
}
private void SwapCoordinates()
{
if (Selection.activeGameObject == null)
{
Debug.LogWarning("No GameObject selected. Please select a GameObject in the hierarchy.");
return;
}
Transform selectedTransform = Selection.activeGameObject.transform;
SwapYAndZRecursive(selectedTransform);
}
private void SwapYAndZRecursive(Transform parentTransform)
{
foreach (Transform child in parentTransform)
{
SwapYAndZRecursive(child);
}
// Swap the position's Y and Z, and invert the Z-axis
Vector3 newPosition = parentTransform.localPosition;
newPosition = new Vector3(newPosition.x, newPosition.z, -newPosition.y);
parentTransform.localPosition = newPosition;
// Swap the rotation's Y and Z, and rotate by -90 degrees on the X-axis
// Vector3 newRotation = parentTransform.localEulerAngles;
// newRotation = new Vector3(newRotation.x - 90, newRotation.z, newRotation.y);
// parentTransform.localEulerAngles = newRotation;
// // Swap the scale's Y and Z, and invert the Z-axis
// Vector3 newScale = parentTransform.localScale;
// newScale = new Vector3(newScale.x, newScale.z, -newScale.y);
// parentTransform.localScale = newScale;
}
}

View File

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

View File

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

View File

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

View File

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

View File

@@ -0,0 +1,52 @@
%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: GhostHorizontalOnlyIndicator
m_EditorClassIdentifier:
serializedUdonProgramAsset: {fileID: 11400000, guid: ec5dc1a411fa93748afcc14c7c05e9c2, type: 2}
udonAssembly:
assemblyError:
sourceCsScript: {fileID: 11500000, guid: 5c42e267ba031f14a8afba9858e3ff5d, type: 3}
scriptVersion: 2
compiledVersion: 2
behaviourSyncMode: 0
hasInteractEvent: 0
scriptID: -3475333653084687851
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: 0
- Name:
Entry: 13
Data:
- Name:
Entry: 8
Data:

View File

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

View File

@@ -0,0 +1,15 @@
namespace Marro.PacManUdon
{
using UdonSharp;
using UnityEngine;
using VRC.SDKBase;
using VRC.Udon;
public class GhostHorizontalOnlyIndicator : UdonSharpBehaviour
{
void Start()
{
}
}
}

View File

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

View File

@@ -0,0 +1,52 @@
%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: GhostTunnelIndicator
m_EditorClassIdentifier:
serializedUdonProgramAsset: {fileID: 11400000, guid: 1190f4be45885db4fb3cee680f69783c, type: 2}
udonAssembly:
assemblyError:
sourceCsScript: {fileID: 11500000, guid: cc0e91108c3d33c4586edcc61f25d6d6, type: 3}
scriptVersion: 2
compiledVersion: 2
behaviourSyncMode: 0
hasInteractEvent: 0
scriptID: 8475396515912883789
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: 0
- Name:
Entry: 13
Data:
- Name:
Entry: 8
Data:

View File

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

View File

@@ -0,0 +1,11 @@
namespace Marro.PacManUdon
{
using UdonSharp;
using UnityEngine;
using VRC.SDKBase;
using VRC.Udon;
public class GhostTunnelIndicator : UdonSharpBehaviour
{
}
}

View File

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

View File

@@ -0,0 +1,52 @@
%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: PacManGhostCollider
m_EditorClassIdentifier:
serializedUdonProgramAsset: {fileID: 11400000, guid: c5c5f319202c800458920423915157d7, type: 2}
udonAssembly:
assemblyError:
sourceCsScript: {fileID: 11500000, guid: 197f2fb3a12aac94795943b0ee8d3320, type: 3}
scriptVersion: 2
compiledVersion: 2
behaviourSyncMode: 0
hasInteractEvent: 0
scriptID: -6949880379881253794
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: 0
- Name:
Entry: 13
Data:
- Name:
Entry: 8
Data:

View File

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

View File

@@ -0,0 +1,11 @@
namespace Marro.PacManUdon
{
using UdonSharp;
using UnityEngine;
using VRC.SDKBase;
using VRC.Udon;
public class PacManGhostCollider : UdonSharpBehaviour
{
}
}

View File

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

View File

@@ -0,0 +1,106 @@
%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: ExtraLivesDisplay
m_EditorClassIdentifier:
serializedUdonProgramAsset: {fileID: 11400000, guid: d8ef055ca1401354d9ed0b443d670409, type: 2}
udonAssembly:
assemblyError:
sourceCsScript: {fileID: 11500000, guid: 9ed210d681f3ca9428b1b946cdb5f9ac, type: 3}
scriptVersion: 2
compiledVersion: 2
behaviourSyncMode: 0
hasInteractEvent: 0
scriptID: -9086562275626157182
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: extraLifeIndicators
- Name: $v
Entry: 7
Data: 2|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: extraLifeIndicators
- Name: <UserType>k__BackingField
Entry: 7
Data: 3|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: UnityEngine.GameObject[], UnityEngine.CoreModule
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 9
Data: 3
- 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: 4|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

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

View File

@@ -0,0 +1,30 @@
namespace Marro.PacManUdon
{
using UdonSharp;
using UnityEngine;
using VRC.SDKBase;
using VRC.Udon;
public class ExtraLivesDisplay : UdonSharpBehaviour
{
GameObject[] extraLifeIndicators;
public void Initialize()
{
Transform[] extraLifeIndicatorTransforms = transform.GetComponentsInChildren<Transform>();
extraLifeIndicators = new GameObject[extraLifeIndicatorTransforms.Length];
for (int i = 0; i < extraLifeIndicatorTransforms.Length; i++)
{
extraLifeIndicators[i] = extraLifeIndicatorTransforms[i].gameObject;
}
}
public bool SetExtraLives(int extraLives)
{
for (int extraLifeIndicatorIndex = 0; extraLifeIndicatorIndex < extraLifeIndicators.Length; extraLifeIndicatorIndex++)
{
extraLifeIndicators[extraLifeIndicatorIndex].SetActive(extraLifeIndicatorIndex < extraLives);
}
return true;
}
}
}

View File

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

616
Assets/Scripts/Fruit.asset Normal file
View File

@@ -0,0 +1,616 @@
%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: Fruit
m_EditorClassIdentifier:
serializedUdonProgramAsset: {fileID: 11400000, guid: 911d813b1d1c79148b86f66d4b586056, type: 2}
udonAssembly:
assemblyError:
sourceCsScript: {fileID: 11500000, guid: 69f55731c01fe80429d32f4509fd13b5, type: 3}
scriptVersion: 2
compiledVersion: 2
behaviourSyncMode: 0
hasInteractEvent: 0
scriptID: -2937323707505996745
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: 10
- Name:
Entry: 7
Data:
- Name: $k
Entry: 1
Data: fruitType
- Name: $v
Entry: 7
Data: 2|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: fruitType
- Name: <UserType>k__BackingField
Entry: 7
Data: 3|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: Marro.PacManUdon.PacManFruitType, Assembly-CSharp
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 7
Data: 4|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: 3
Data: 1
- 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: 3
- Name:
Entry: 7
Data: 6|UnityEngine.SerializeField, UnityEngine.CoreModule
- Name:
Entry: 8
Data:
- Name:
Entry: 7
Data: 7|UdonSharp.UdonSyncedAttribute, UdonSharp.Runtime
- Name:
Entry: 8
Data:
- Name:
Entry: 7
Data: 8|UdonSharp.FieldChangeCallbackAttribute, 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: animator
- Name: $v
Entry: 7
Data: 9|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: animator
- Name: <UserType>k__BackingField
Entry: 7
Data: 10|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: UnityEngine.Animator, UnityEngine.AnimationModule
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 9
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: 11|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: renderer
- Name: $v
Entry: 7
Data: 12|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: renderer
- Name: <UserType>k__BackingField
Entry: 7
Data: 13|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: UnityEngine.Renderer, UnityEngine.CoreModule
- 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: 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: collider
- Name: $v
Entry: 7
Data: 15|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: collider
- Name: <UserType>k__BackingField
Entry: 7
Data: 16|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: UnityEngine.Collider, UnityEngine.PhysicsModule
- 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: scoreBonusDisplay
- Name: $v
Entry: 7
Data: 18|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: scoreBonusDisplay
- Name: <UserType>k__BackingField
Entry: 7
Data: 19|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: Marro.PacManUdon.ScoreBonusDisplay, Assembly-CSharp
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 7
Data: 20|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: false
- Name: _fieldAttributes
Entry: 7
Data: 21|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: active
- Name: $v
Entry: 7
Data: 22|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: active
- Name: <UserType>k__BackingField
Entry: 7
Data: 23|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: System.Boolean, mscorlib
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 9
Data: 23
- 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: 24|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 1
- Name:
Entry: 7
Data: 25|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: value
- Name: $v
Entry: 7
Data: 26|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: value
- Name: <UserType>k__BackingField
Entry: 9
Data: 4
- 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: 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: activeCountdown
- Name: $v
Entry: 7
Data: 28|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: activeCountdown
- Name: <UserType>k__BackingField
Entry: 7
Data: 29|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: System.Single, mscorlib
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 9
Data: 29
- 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: 30|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: frozen
- Name: $v
Entry: 7
Data: 31|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: frozen
- Name: <UserType>k__BackingField
Entry: 9
Data: 23
- Name: <SystemType>k__BackingField
Entry: 9
Data: 23
- 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:
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: fruitScoreValue
- Name: $v
Entry: 7
Data: 33|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: fruitScoreValue
- Name: <UserType>k__BackingField
Entry: 7
Data: 34|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: VRC.SDK3.Data.DataDictionary, VRCSDK3
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 9
Data: 34
- 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: 35|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

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

File diff suppressed because it is too large Load Diff

View File

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

File diff suppressed because it is too large Load Diff

View File

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

View File

@@ -0,0 +1,69 @@
// // Silly me for wanting to make the code neat, forgot this was Udon :)
// using System.Collections;
// using System.Collections.Generic;
// using UdonSharp;
// using UnityEngine;
// public class GameStartSequence : TimeSequence
// {
// GameStateManager gameStateManager;
// StatusDisplay statusDisplay;
// public GameStartSequence(GameStateManager gameStateManager, StatusDisplay statusDisplay) : base(DeltaToAbsolute(new float[]
// {0, 0.016f, 2.2f, 0.032f, 0.032f, 1.92f, 0.032f}
// ))
// {
// this.gameStateManager = gameStateManager;
// this.statusDisplay = statusDisplay;
// }
// protected override void SequenceStep(int sequneceProgress)
// {
// switch (SequenceProgress)
// {
// case 0:
// // Prepare new game, hide everything except score bar
// gameStateManager.SetFrozen(true);
// gameStateManager.StartNewGame();
// gameStateManager.SetPelletsVisible(false);
// gameStateManager.SetMazeVisible(false);
// gameStateManager.SetGhostsVisible(false);
// gameStateManager.SetPacManVisible(false);
// statusDisplay.SetExtraLivesDisplayVisible(false);
// statusDisplay.SetLevelDisplayVisible(false);
// break;
// case 1:
// // Show maze, lives indicator, level indicator, player 1 and ready text
// gameStateManager.SetPelletsVisible(true);
// gameStateManager.SetMazeVisible(true);
// statusDisplay.SetExtraLivesDisplayVisible(true);
// statusDisplay.SetLevelDisplayVisible(true);
// statusDisplay.SetPlayer1TextVisible(true);
// statusDisplay.SetReadyTextVisible(true);
// break;
// case 2:
// // Subtract a life
// gameStateManager.DecrementLives();
// break;
// case 3:
// // Remove Player 1 text
// statusDisplay.SetPlayer1TextVisible(false);
// break;
// case 4:
// // Show ghosts and pacman
// gameStateManager.SetGhostsVisible(true);
// gameStateManager.SetPacManVisible(true);
// break;
// case 5:
// // Remove ready text
// statusDisplay.SetReadyTextVisible(true);
// break;
// case 6:
// // Start game, end sequence
// gameStateManager.SetFrozen(false);
// break;
// }
// }
// }

View File

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

2042
Assets/Scripts/Ghost.asset Normal file

File diff suppressed because it is too large Load Diff

View File

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

849
Assets/Scripts/Ghost.cs Normal file
View File

@@ -0,0 +1,849 @@
#define RECORDING_DEMO
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
{
Caught,
Scared,
ScaredWhite,
Blinky,
Pinky,
Inky,
Clyde
}
public enum PacManGhostState
{
Normal,
CaughtScore,
Returning,
Entering,
Home,
Exiting
}
public enum PacManGhostStartState
{
Outside,
TargetingIdlePosition1,
TargetingIdlePosition2
}
public class Ghost : GridMover
{
[SerializeField] private PacManGhostType ghostType;
[SerializeField] private PacManGhostStartState startState;
private GhostManager ghostManager;
private Animator animator;
private new Renderer renderer;
private PacMan pacMan;
private Ghost blinky;
private ScoreBonusDisplay scoreBonusDisplay;
private Vector3 startPosition;
private Quaternion startRotation;
private Vector3 startScale;
private Vector2 homePosition;
private Vector2 idlePosition1;
private Vector2 idlePosition2;
private Vector2 cornerPosition;
private bool kinematic;
private bool horizontalOnly;
private int housePelletCounterLimit;
private bool faceInStartingDirectionUntilUnfrozen;
private bool followingPredefinedPath;
private Vector2[] predefinedPath;
private int predefinedPathIndex;
[UdonSynced] int rngState;
[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, Vector2 homePosition, Vector2 idlePosition1, Vector2 idlePosition2, Vector2 cornerPosition)
{
ghostManager = transform.parent.GetComponent<GhostManager>();
animator = GetComponent<Animator>();
renderer = GetComponent<Renderer>();
this.pacMan = pacMan;
this.blinky = blinky;
this.homePosition = homePosition;
this.idlePosition1 = idlePosition1;
this.idlePosition2 = idlePosition2;
this.cornerPosition = cornerPosition;
scoreBonusDisplay = transform.Find("ScoreBonusDisplay").gameObject.GetComponent<ScoreBonusDisplay>();
scoreBonusDisplay.Initialize();
startPosition = transform.localPosition;
startRotation = transform.localRotation;
startScale = transform.localScale;
frozenState = PacManGhostFrozenState.Frozen;
// Debug.Log($"{gameObject} Begin localScale = {initialScale}");
}
public void Reset()
{
// Debug.Log($"{gameObject} Reset!");
transform.localPosition = startPosition;
transform.localRotation = startRotation;
transform.localScale = startScale;
// Debug.Log($"{gameObject} Reset localScale = {transform.localScale}");
if (startState == PacManGhostStartState.Outside)
{
ghostState = PacManGhostState.Exiting;
OffGridTargetReached();
}
else
{
if (startState == PacManGhostStartState.TargetingIdlePosition1)
{
SetOffGridTarget(idlePosition1, false);
}
ghostState = PacManGhostState.Entering;
OffGridTargetReached();
}
isScared = false;
inTunnel = false;
kinematic = false;
followingPredefinedPath = false;
turnAroundSoon = false;
// scattering = true;
rngState = 1;
UpdateSpeed();
faceInStartingDirectionUntilUnfrozen = true;
UpdateAnimator();
// animator.Play(0, -1, 0);
// Debug.Log($"{gameObject} reset with state: {state}, target: {target}, offGrid: {offGrid}");
}
void FixedUpdate()
{
if (ghostType == PacManGhostType.Blinky)
{
// ghostManager.gameStateManager.statusDisplay.SetDebugText(2, $"{turnAroundSoon}");
}
if (frozenState == PacManGhostFrozenState.Frozen ||
(frozenState == PacManGhostFrozenState.FrozenIfNotCaught && ((ghostState != PacManGhostState.Returning && ghostState != PacManGhostState.Entering) || hideUntilUnfrozen)))
{
return;
}
Vector2 position = GetPosition();
Vector2 nextPosition = GridMoverTools.GetNextPosition(position, direction, speed);
nextPosition = ProcessNextPosition(position, nextPosition);
SetPosition(nextPosition);
}
private Vector2 ProcessNextPosition(Vector2 position, Vector2 nextPosition)
{
if (turnAroundSoon && ghostState == PacManGhostState.Normal
&& GridMoverTools.CrossesTileBorder(position, nextPosition, direction.x != 0, direction.y != 0))
{
// Debug.Log($"{gameObject} turned around");
SetDirection(direction * -1);
turnAroundSoon = false;
}
if (kinematic)
{
return nextPosition;
}
if (offGrid || ghostState == PacManGhostState.Returning)
{
bool XAxisAlligned = CheckAndAllignToTargetX(position, nextPosition, target);
bool YAxisAlligned = CheckAndAllignToTargetY(position, nextPosition, target);
if (offGrid)
{
if (XAxisAlligned)
{
nextPosition.x = target.x;
}
if (YAxisAlligned)
{
nextPosition.y = target.y;
}
}
if (XAxisAlligned && YAxisAlligned)
{
if (!offGrid)
{
nextPosition = target;
}
OffGridTargetReached();
// Debug.Log($"{gameObject} reached offGridTarget {target} at position {position}, new state {state}, offGrid is now {offGrid}, new direction: {direction}");
}
if ((XAxisAlligned || YAxisAlligned) && offGrid)
{
SetDirection(GetOffGridDirectionToTarget(nextPosition, target, direction));
// Debug.Log($"{gameObject} Alligned X Axis: {XAxisAlligned}, Y Axis: {YAxisAlligned} with position: {position}, new nextPosition: {nextPosition}, new target: {target}, now moving in direction {direction}");
// nextPosition = GridMover.GetNextPosition(position, direction, speed);
}
}
if (!offGrid && followingPredefinedPath)
{
nextPosition = ProcessPredefinedPath(position, nextPosition);
}
else if (!offGrid && GridMoverTools.CrossesTileCenter(position, nextPosition, direction.x != 0, direction.y != 0))
{
Vector2 gridPosition = GridMoverTools.PositionToGrid(position);
Vector2[] availableDirections = GetAvailableDirections(gridPosition, direction * -1);
if (availableDirections.Length > 1)
{
target = GetGridTarget(gridPosition);
SetDirection(GetGridDirectionToTargetGreedy(availableDirections, gridPosition, target));
nextPosition = GridMoverTools.GetNextPosition(gridPosition, direction, speed);
// Debug.Log($"GetNextPosition at gridPosition {gridPosition} with direction {direction} and speed {speed} gives nextPosition {nextPosition}");
}
else if (availableDirections.Length == 1 && availableDirections[0] != direction)
{
SetDirection(availableDirections[0]);
nextPosition = GridMoverTools.GetNextPosition(gridPosition, direction, speed);
}
// Debug.Log($"{gameObject} crossed tile center {gridPosition}, new target: {target}, new direction: {direction}");
}
return nextPosition;
}
private Vector2 ProcessPredefinedPath(Vector2 position, Vector2 nextPosition)
{
if (GridMoverTools.CrossesTileCenter(position, nextPosition, direction.x != 0, direction.y != 0))
{
// Find the next valid direction which isn't Vector2.zero
int nextValidDirectionIndex = predefinedPathIndex;
while (predefinedPath[nextValidDirectionIndex] == Vector2.zero)
{
nextValidDirectionIndex += 1;
}
if (!GridMoverTools.CheckCollisionInDirection(transform, nextPosition, predefinedPath[nextValidDirectionIndex]))
{
// If we're at a Vector2.zero, we skip applying the direction and only increment.
if (nextValidDirectionIndex == predefinedPathIndex)
{
SetDirection(predefinedPath[nextValidDirectionIndex]);
nextPosition = GridMoverTools.PositionToGrid(nextPosition) + direction.normalized * 0.01f;
// Check if we've reached the end of the path, which includes making sure the path doesn't end on Vector2.zero
do
{
nextValidDirectionIndex += 1;
if (nextValidDirectionIndex >= predefinedPath.Length)
{
followingPredefinedPath = false;
break;
}
} while (predefinedPath[nextValidDirectionIndex] == Vector2.zero);
}
// ghostManager.gameStateManager.statusDisplay.SetDebugText(1, predefinedPathIndex.ToString());
predefinedPathIndex++;
}
}
return nextPosition;
}
Vector2 GetGridTarget(Vector2 gridPosition)
{
// if (followingPredefinedPath)
// {
// predefinedPathIndex++;
// if (predefinedPathIndex >= predefinedPath.Length)
// {
// followingPredefinedPath = false;
// }
// return gridPosition + predefinedPath[predefinedPathIndex];
// }
if (isScared)
{
switch (PseudoRNG() % 4)
{
default:
return gridPosition;
case 0:
return gridPosition + Vector2.up;
case 1:
return gridPosition + Vector2.left;
case 2:
return gridPosition + Vector2.down;
case 3:
return gridPosition + Vector2.right;
}
}
switch (ghostState)
{
default:
return gridPosition;
case PacManGhostState.Normal:
if (scattering)
{
return cornerPosition;
}
switch (ghostType)
{
default:
return gridPosition;
case PacManGhostType.Blinky:
return GridMoverTools.PositionToGrid(pacMan.transform.localPosition);
case PacManGhostType.Pinky:
return GridMoverTools.PositionToGrid(pacMan.transform.localPosition) + pacMan.GetDirection() * 4;
case PacManGhostType.Inky:
return 2 * GridMoverTools.PositionToGrid(pacMan.transform.localPosition) + 4 * pacMan.GetDirection() - GridMoverTools.PositionToGrid(blinky.transform.localPosition);
case PacManGhostType.Clyde:
if (Vector2.Distance(gridPosition, GridMoverTools.PositionToGrid(pacMan.transform.localPosition)) >= 8)
{
return GridMoverTools.PositionToGrid(pacMan.transform.localPosition);
}
else
{
// Debug.Log($"{gameObject} goes to cornerPosition {cornerPosition}");
return cornerPosition;
}
}
case PacManGhostState.Returning:
return homePosition;
}
}
bool CheckAndAllignToTargetX(Vector2 currentPosition, Vector2 nextPosition, Vector2 target)
{
return (currentPosition.x - target.x) * (nextPosition.x - target.x) <= 0.01;
}
bool CheckAndAllignToTargetY(Vector2 currentPosition, Vector2 nextPosition, Vector2 target)
{
return (currentPosition.y - target.y) * (nextPosition.y - target.y) <= 0.01;
}
void OffGridTargetReached()
{
switch (ghostState)
{
case PacManGhostState.Returning:
offGrid = true;
SetState(PacManGhostState.Entering);
SetOffGridTarget(idlePosition2, false);
break;
case PacManGhostState.Entering:
offGrid = true;
SetState(PacManGhostState.Home);
if (!target.Equals(idlePosition1))
{ // This is idlePosition1 if PacManGhostStartState == TargetingIdlePosition1
SetOffGridTarget(idlePosition2, false);
}
TryToExit();
break;
case PacManGhostState.Home:
if (target.Equals(idlePosition1))
{
SetOffGridTarget(idlePosition2, false);
}
else
{
SetOffGridTarget(idlePosition1, false);
}
break;
case PacManGhostState.Exiting:
offGrid = false;
SetState(PacManGhostState.Normal);
SetDirection(Vector2.left);
break;
}
}
void SetOffGridTarget(Vector2 newTarget, bool startHorizontal)
{
if (startHorizontal)
{
SetDirection(GetOffGridDirectionToTarget(GetPosition(), newTarget, Vector2.right));
}
else
{
SetDirection(GetOffGridDirectionToTarget(GetPosition(), newTarget, Vector2.down));
}
// Debug.Log($"{gameObject} SetOffGridTarget with position {GetPosition()}, newTarget {newTarget}, startHorizontal {startHorizontal} resulted in direction {direction}");
target = newTarget;
}
public int PseudoRNG()
{
rngState ^= rngState << 13;
rngState ^= rngState >> 17;
rngState ^= rngState << 5;
return rngState;
}
Vector2[] GetAvailableDirections(Vector2 gridPosition, Vector2 discardDirection)
{
Vector2[] directions;
Vector2[] availableDirections;
if (horizontalOnly && ghostState == PacManGhostState.Normal)
{
directions = new Vector2[] { new Vector2(1, 0), new Vector2(-1, 0) };
availableDirections = new Vector2[2];
}
else
{
directions = new Vector2[] { new Vector2(0, 1), new Vector2(1, 0), new Vector2(0, -1), new Vector2(-1, 0) };
availableDirections = new Vector2[4];
}
int availableDirectionsNum = 0;
for (int i = 0; i < directions.Length; i++)
{
if (directions[i].Equals(discardDirection) || GridMoverTools.CheckCollisionInDirection(transform, gridPosition, directions[i]))
{
continue;
}
availableDirections[availableDirectionsNum] = directions[i];
availableDirectionsNum++;
}
Vector2[] availableDirectionsTrimmed = new Vector2[availableDirectionsNum];
// Debug.Log($"{gameObject} Number of available directions: {availableDirectionsTrimmed.Length}");
Array.Copy(availableDirections, 0, availableDirectionsTrimmed, 0, availableDirectionsNum);
return availableDirectionsTrimmed;
}
Vector2 GetGridDirectionToTargetGreedy(Vector2[] availableDirections, Vector2 gridPosition, Vector2 targetGridPosition)
{
Vector2 bestDirection = Vector2.zero;
float bestDistance = float.MaxValue;
for (int i = 0; i < availableDirections.Length; i++)
{
Vector2 direction = availableDirections[i];
// Debug.Log("Evaluating direction " + direction);
float distance = Vector2.Distance(gridPosition + direction, targetGridPosition);
if (distance < bestDistance)
{
bestDistance = distance;
bestDirection = direction;
}
}
// Debug.Log("Closest next tile is in direction " + bestDirection);
return bestDirection;
}
Vector2 GetOffGridDirectionToTarget(Vector2 position, Vector2 target, Vector2 direction)
{
if ((direction.x != 0 && position.x != target.x) || position.y == target.y)
{
// Debug.Log($"{gameObject} getOffGridDirectionToTarget with position {position}, target {target} and direction {direction} gives movement on the X axis in direction {new Vector2(target.x-position.x, 0).normalized}");
return new Vector2(target.x - position.x, 0).normalized;
}
else
{
// Debug.Log($"{gameObject} getOffGridDirectionToTarget with position {position}, target {target} and direction {direction} gives movement on the Y axis in direction {new Vector2(0, target.y-position.y).normalized}");
return new Vector2(0, target.y - position.y).normalized;
}
}
private void UpdateAnimator()
{
if (!gameObject.activeInHierarchy)
return;
// Debug.Log($"{gameObject} UpdateAnimator with state: {ghostState}, isScared: {isScared}, direction: {direction}");
if (isScared)
{
float currentGhostType = animator.GetFloat("GhostType");
if (currentGhostType > 0.5f && currentGhostType < 2.5f)
{
return;
}
animator.SetFloat("GhostType", GhostTypeToAnimationValue(PacManGhostType.Scared));
}
else
{
switch (ghostState)
{
default:
case PacManGhostState.Normal:
case PacManGhostState.Home:
case PacManGhostState.Exiting:
// Debug.Log($"{gameObject} Set GhostType in animator to: {GhostTypeToAnimationValue(ghostType)}");
animator.SetFloat("GhostType", GhostTypeToAnimationValue(ghostType));
break;
case PacManGhostState.Returning:
case PacManGhostState.Entering:
animator.SetFloat("GhostType", GhostTypeToAnimationValue(PacManGhostType.Caught));
break;
}
}
if (faceInStartingDirectionUntilUnfrozen && startState == PacManGhostStartState.TargetingIdlePosition1)
{
animator.SetFloat("DirX", 0);
animator.SetFloat("DirY", 1);
}
else if (faceInStartingDirectionUntilUnfrozen && startState == PacManGhostStartState.TargetingIdlePosition2)
{
animator.SetFloat("DirX", 0);
animator.SetFloat("DirY", -1);
}
else if (!direction.Equals(Vector2.zero))
{
animator.SetFloat("DirX", direction.x);
animator.SetFloat("DirY", direction.y);
}
}
private float GhostTypeToAnimationValue(PacManGhostType ghostType)
{
switch (ghostType)
{
default:
case PacManGhostType.Caught:
return 0;
case PacManGhostType.Scared:
return 1;
case PacManGhostType.ScaredWhite:
return 2;
case PacManGhostType.Blinky:
return 3;
case PacManGhostType.Pinky:
return 4;
case PacManGhostType.Inky:
return 5;
case PacManGhostType.Clyde:
return 6;
}
}
void UpdateSpeed()
{
speed = ghostManager.GetTargetSpeed(this, ghostState, isScared, inTunnel);
}
public void ResetHousePelletCounter()
{
housePelletCounter = 0;
}
public void IncrementHousePelletCounter()
{
housePelletCounter++;
TryToExit();
}
void TryToExit()
{
if ((housePelletCounterActive && housePelletCounter >= housePelletCounterLimit) || startState == PacManGhostStartState.Outside)
{
Release();
}
}
public void Caught(int scoreBonus)
{
isScared = false;
// direction = direction * -1;
target = homePosition;
scoreBonusDisplay.Display(scoreBonus);
SetVisibility(false);
SetState(PacManGhostState.CaughtScore);
}
public void ReturnHome()
{
SetVisibility(true);
scoreBonusDisplay.Hide();
SetState(PacManGhostState.Returning);
}
public void BecomeScared()
{
if (ghostState == PacManGhostState.Returning || ghostState == PacManGhostState.Entering)
{
return;
}
if (ghostState == PacManGhostState.Normal || ghostState == PacManGhostState.Home || ghostState == PacManGhostState.Exiting)
{
turnAroundSoon = true;
}
SetScared(true);
}
public void CalmDown()
{
if (isScared)
{
SetScared(false);
}
}
public void Release()
{
// Debug.Log($"{gameObject} was released.");
if (ghostState == PacManGhostState.Home)
{
// Debug.Log($"{gameObject} released.");
SetOffGridTarget(homePosition, true);
SetState(PacManGhostState.Exiting);
}
}
public void SetState(PacManGhostState state)
{
ghostState = state;
UpdateAnimator();
UpdateSpeed();
if (Networking.IsOwner(gameObject))
{
RequestSerialization();
}
}
public void SetScared(bool scared)
{
isScared = scared;
UpdateAnimator();
UpdateSpeed();
if (isScared)
{
SetWhite(false);
}
if (Networking.IsOwner(gameObject))
{
RequestSerialization();
}
}
public void SetScattering(bool scattering, bool reverseDirection = true)
{
if (reverseDirection && this.scattering != scattering)
{
if (ghostState == PacManGhostState.Normal || ghostState == PacManGhostState.Home || ghostState == PacManGhostState.Exiting
#if RECORDING_DEMO
|| ghostState == PacManGhostState.Entering // This is afaik not normal PacMan behaviour, but is needed to accomidate slight timing differences
#endif
)
{
turnAroundSoon = true;
}
}
this.scattering = scattering;
UpdateAnimator();
RequestSerialization();
}
public void SetFrozen(bool frozen, bool ignoreIfCaught = false, bool keepAnimating = false)
{
if (frozen && !ignoreIfCaught)
{
frozenState = PacManGhostFrozenState.Frozen;
}
else if (frozen && ignoreIfCaught)
{
frozenState = PacManGhostFrozenState.FrozenIfNotCaught;
}
else
{
frozenState = PacManGhostFrozenState.NotFrozen;
}
animator.speed = frozen && !keepAnimating ? 0 : 1; // This would cause issues if the returning sprite was animated, luckily it isn't :)
if (frozen == false)
{
if (faceInStartingDirectionUntilUnfrozen)
{
faceInStartingDirectionUntilUnfrozen = false;
UpdateAnimator();
}
}
}
public void SetHousePelletCounterActive(bool active)
{
housePelletCounterActive = active;
}
public void SetHousePelletCounterLimit(int limit)
{
housePelletCounterLimit = limit;
}
public void SetWhite(bool white)
{
if (!isScared || !gameObject.activeInHierarchy)
return;
if (white)
{
animator.SetFloat("GhostType", 2);
}
else
{
animator.SetFloat("GhostType", 1);
}
}
public void SetElroy(int elroyLevel)
{
// Debug.Log($"{gameObject} became Elroy level {elroyLevel}");
if (elroyLevel > 0)
{
SetScattering(false, reverseDirection: false);
}
UpdateSpeed();
}
public void SetActive(bool active)
{
gameObject.SetActive(active);
renderer.enabled = active;
if (active)
{
UpdateAnimator();
}
}
public void SetKinematic(bool kinematic)
{
this.kinematic = kinematic;
}
public void SetPredefinedPath(Vector2[] predefinedPath)
{
this.predefinedPath = predefinedPath;
followingPredefinedPath = true;
predefinedPathIndex = 0;
}
void SetInTunnel(bool inTunnel)
{
this.inTunnel = inTunnel;
UpdateSpeed();
}
void SetVisibility(bool visible)
{
renderer.enabled = visible;
}
public PacManGhostState GetGhostState()
{
return ghostState;
}
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 override void OnPreSerialization()
{
syncedPosition = GetPosition();
}
public override void OnDeserialization()
{
SetPosition(syncedPosition);
UpdateAnimator();
}
void OnTriggerEnter(Collider other)
{
if (Networking.IsOwner(gameObject) && other.gameObject.GetComponent<PacManGhostCollider>())
{
if (isScared)
{
// Debug.Log($"{gameObject} was cought!");
ghostManager.GhostCaughtQueue(this);
}
else if (ghostState == PacManGhostState.Normal)
{
// Debug.Log($"{gameObject} cought PacMan!");
ghostManager.CapturedPacMan();
}
}
else if (other.gameObject.GetComponent<GhostHorizontalOnlyIndicator>())
{
horizontalOnly = true;
}
else if (other.gameObject.GetComponent<GhostTunnelIndicator>())
{
SetInTunnel(true);
}
}
void OnTriggerExit(Collider other)
{
if (other.gameObject.GetComponent<GhostHorizontalOnlyIndicator>())
{
horizontalOnly = false;
}
else if (other.gameObject.GetComponent<GhostTunnelIndicator>())
{
SetInTunnel(false);
}
}
PacManGhostState State
{
set
{
SetState(value);
}
get => ghostState;
}
}
}

View File

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

File diff suppressed because it is too large Load Diff

View File

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

View File

@@ -0,0 +1,453 @@
namespace Marro.PacManUdon
{
using System;
using UdonSharp;
using UnityEngine;
using VRC.SDKBase;
using VRC.Udon;
using VRC.SDK3.Data;
public class GhostManager : UdonSharpBehaviour
{
[NonSerialized] public GameController gameController;
private Ghost[] ghosts;
private Ghost blinky;
// Level constants
private float speedDefault;
private float speedScared;
private float speedReturn;
private float speedTunnel;
private float speedHome;
private float speedElroy1;
private float speedElroy2;
private int elroy1PelletCount;
private int elroy2PelletCount;
// Power Pellet logic
private bool powerPelletActive;
private float powerPelletDuration;
private float powerPelletCountdown;
private int powerPelletMultiplier;
private DataList ghostScaredQueue;
// Blink logic
private float blinkCycleRate = 0.233333333f;
private bool blinkingActivated;
private float blinkCountdown;
private bool blinkCurrentlyWhite;
// Scattering logic
private float scatterCounter;
private float[] scatterPattern;
private int scatterPatternIndex;
// Elroy logic
private int elroyLevel;
private int pelletsRemaining;
// Ghost house logic
private bool sharedPelletCounterActive;
private int sharedPelletCounter;
private int[] sharedPelletCounterReleaseValues = { 0, 7, 17, 32 };
private float pelletTimeout;
private float pelletTimeoutLimit;
private bool frozen;
// This should be called once when the game is initialized
public void Initialize(GameObject[] ghostTargets, PacMan pacMan, GameController gameController)
{
this.gameController = gameController;
ghosts = transform.GetComponentsInChildren<Ghost>(true);
blinky = ghosts[0];
for (int ghostIndex = 0; ghostIndex < ghosts.Length; ghostIndex++)
{
Vector2 homePosition = ghostTargets[0].transform.localPosition;
Vector2 idlePosition1 = ghostTargets[1 + ghostIndex * 3].transform.localPosition;
Vector2 idlePosition2 = ghostTargets[2 + ghostIndex * 3].transform.localPosition;
Vector2 cornerPosition = ghostTargets[3 + ghostIndex * 3].transform.localPosition;
ghosts[ghostIndex].Initialize(pacMan, blinky, homePosition, idlePosition1, idlePosition2, cornerPosition);
}
}
// This should be called every time the level is reset
public void Reset()
{
ghostScaredQueue = new DataList();
powerPelletActive = false;
scatterCounter = 0;
scatterPatternIndex = 0;
SetScattering(false, reverseDirection: false);
sharedPelletCounter = 0;
pelletTimeout = 0;
foreach (Ghost ghost in ghosts)
{
ghost.Reset();
}
SetScattering(true, reverseDirection: false);
}
public void NewLevel()
{
SetSharedPelletCounterActive(false);
foreach (Ghost ghost in ghosts)
{
ghost.ResetHousePelletCounter();
}
}
public void LifeLost()
{
SetSharedPelletCounterActive(true);
}
public void FixedUpdate()
{
// gameStateManager.statusDisplay.SetDebugText(1, this.blinkCountdown.ToString());
if (frozen)
{
return;
}
UpdatePelletTimeout();
if (powerPelletActive)
{
UpdatePowerPellet();
}
else
{
UpdateScattering();
}
}
void UpdateScattering()
{
scatterCounter += Time.deltaTime;
if (scatterPatternIndex < scatterPattern.Length && scatterCounter >= scatterPattern[scatterPatternIndex])
{
// Debug.Log($"{gameObject} SetScattering: {scatterPatternIndex%1 == 0}, scatterCounter: {scatterCounter}, scatterPattern: {scatterPattern[scatterPatternIndex]}, scatterPatternIndex: {scatterPatternIndex}");
scatterPatternIndex++;
SetScattering(scatterPatternIndex % 2 == 0);
}
}
void UpdatePowerPellet()
{
powerPelletCountdown -= Time.deltaTime;
if (powerPelletCountdown <= 0)
{
gameController.EndPowerPellet(); // End power pellet
SetPowerPellet(false);
}
else if (!blinkingActivated && powerPelletCountdown <= 2.1166667)
{
SetGhostBlinking(true);
}
if (blinkingActivated)
{
blinkCountdown -= Time.deltaTime;
if (blinkCountdown <= 0)
{
blinkCountdown += blinkCycleRate;
SetGhostBlinkingState(!blinkCurrentlyWhite);
}
}
}
void UpdatePelletTimeout()
{
pelletTimeout += Time.deltaTime;
if (pelletTimeout >= pelletTimeoutLimit)
{
pelletTimeout -= pelletTimeoutLimit;
for (int ghostIndex = 0; ghostIndex < ghosts.Length; ghostIndex++)
{
Ghost ghost = ghosts[ghostIndex];
if (ghost.GetGhostState() == PacManGhostState.Home)
{
ghost.Release();
break;
}
}
}
}
public void GhostCaughtQueue(Ghost ghost)
{
if (gameController.GameState == PacManGameState.AttractMode)
{
gameController.GhostCaught(0);
return;
}
Debug.Log($"{gameObject} GhostCaughtQueue with ghost {ghost}");
ghostScaredQueue.Add(ghost);
GhostCaughtExecute(ghost);
}
public void GhostCaughtContinue()
{
Debug.Log($"{gameObject} GhostCaughtContinue with ghost queue length {ghostScaredQueue.Count}");
if (!ghostScaredQueue.TryGetValue(0, out DataToken currentGhost))
{
Debug.LogError("Called GhostCaughtContinue without a ghost in the queue!");
return;
}
((Ghost)currentGhost.Reference).ReturnHome();
ghostScaredQueue.RemoveAt(0);
if (ghostScaredQueue.TryGetValue(0, out DataToken nextGhost))
{
GhostCaughtExecute((Ghost)nextGhost.Reference);
}
}
void GhostCaughtExecute(Ghost ghost)
{
int scoreBonus = 200 * (int)Math.Pow(2, powerPelletMultiplier);
powerPelletMultiplier += 1;
ghost.Caught(scoreBonus);
gameController.GhostCaught(scoreBonus);
}
public void CapturedPacMan()
{
gameController.PacManCaught();
}
void SetGhostBlinking(bool blinking)
{
blinkingActivated = blinking;
if (blinking == true)
{
blinkCountdown = blinkCycleRate;
SetGhostBlinkingState(true);
}
}
void SetGhostBlinkingState(bool white)
{
blinkCurrentlyWhite = white;
foreach (Ghost ghost in ghosts)
{
ghost.SetWhite(white);
}
}
public void SetPowerPellet(bool powerPelletActive)
{
this.powerPelletActive = powerPelletActive;
if (powerPelletActive)
{
powerPelletCountdown = powerPelletDuration;
powerPelletMultiplier = 0;
SetGhostBlinking(false);
foreach (Ghost ghost in ghosts)
{
ghost.BecomeScared();
}
}
if (!powerPelletActive || powerPelletDuration == 0)
{
foreach (Ghost ghost in ghosts)
{
ghost.CalmDown();
SetGhostBlinking(false);
}
}
}
public void SetFrozen(bool frozen, bool ignoreIfCaught = false)
{
this.frozen = frozen;
foreach (Ghost ghost in ghosts)
{
ghost.SetFrozen(frozen, ignoreIfCaught: ignoreIfCaught);
}
}
public void SetLevel(int level)
{
speedDefault = PacManConstants.GetGhostDefaultSpeedForLevel(level);
speedScared = PacManConstants.GetGhostScaredSpeedForLevel(level);
speedReturn = 15f;
speedTunnel = PacManConstants.GetGhostTunnelSpeedForLevel(level);
speedHome = PacManConstants.GetGhostHomeSpeed();
speedElroy1 = PacManConstants.GetBlinkyElroy1SpeedForLevel(level);
speedElroy2 = PacManConstants.GetBlinkyElroy2SpeedForLevel(level);
elroy1PelletCount = PacManConstants.GetElroy1PelletsRemainingForLevel(level);
elroy2PelletCount = PacManConstants.GetElroy2PelletsRemainingForLevel(level);
powerPelletDuration = PacManConstants.GetScaredDurationForLevel(level);
scatterPattern = PacManConstants.GetScatterPatternForLevel(level);
pelletTimeoutLimit = PacManConstants.GetGhostHousePelletTimeoutLimitForLevel(level);
int[] privatePelletCounterReleaseValues = PacManConstants.GetGhostHousePrivatePelletCounterLimitForLevel(level);
for (int i = 0; i < Math.Min(sharedPelletCounterReleaseValues.Length, ghosts.Length); i++)
{
ghosts[i].SetHousePelletCounterLimit(privatePelletCounterReleaseValues[i]);
}
}
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)
{
if (ghostState == PacManGhostState.Returning || ghostState == PacManGhostState.Entering)
{
return speedReturn;
}
if (inTunnel)
{
return speedTunnel;
}
if (ghostState == PacManGhostState.Exiting || ghostState == PacManGhostState.Home)
{
return speedHome;
}
if (isScared)
{
return speedScared;
}
if (ghost == blinky)
{
if (elroyLevel == 1)
{
return speedElroy1;
}
if (elroyLevel == 2)
{
return speedElroy2;
}
}
return speedDefault;
}
void SetScattering(bool scattering, bool reverseDirection = true)
{
Debug.Log($"{gameObject} SetScattering: {scattering}");
foreach (Ghost ghost in ghosts)
{
if (ghost == blinky && pelletsRemaining <= elroy1PelletCount)
{
continue;
}
ghost.SetScattering(scattering, reverseDirection);
}
}
public void SetPelletsRemaining(int pelletsRemaining)
{
this.pelletsRemaining = pelletsRemaining;
UpdateElroyLevel();
}
void SetSharedPelletCounterActive(bool active)
{
// Debug.Log($"{gameObject} SetSharedPelletCounterActive {active}");
sharedPelletCounterActive = active;
foreach (Ghost ghost in ghosts)
{
ghost.SetHousePelletCounterActive(!active);
}
}
public void PelletConsumed()
{
SetPelletsRemaining(pelletsRemaining - 1);
pelletTimeout = 0;
if (sharedPelletCounterActive)
{
IncrementSharedPelletCounter();
}
else
{
IncrementPrivatePelletCounter();
}
}
void IncrementSharedPelletCounter()
{
sharedPelletCounter++;
for (int ghostIndex = 0; ghostIndex < sharedPelletCounterReleaseValues.Length; ghostIndex++)
{
Ghost ghost = ghosts[ghostIndex];
if (ghost.GetGhostState() == PacManGhostState.Home && sharedPelletCounter == sharedPelletCounterReleaseValues[ghostIndex])
{
ghost.Release();
if (ghostIndex == sharedPelletCounterReleaseValues.Length - 1)
{
SetSharedPelletCounterActive(false);
}
}
}
}
void IncrementPrivatePelletCounter()
{
for (int ghostIndex = 0; ghostIndex < ghosts.Length; ghostIndex++)
{
Ghost ghost = ghosts[ghostIndex];
if (ghost.GetGhostState() == PacManGhostState.Home)
{
ghost.IncrementHousePelletCounter();
break;
}
}
}
void UpdateElroyLevel()
{
// Debug.Log($"{gameObject} Updating Elroy Level with pelletsRemaining {pelletsRemaining} with elroy2PelletCount {elroy2PelletCount} and elroy1PelletCount {elroy1PelletCount}");
int oldElroyLevel = elroyLevel;
if (pelletsRemaining < elroy2PelletCount) elroyLevel = 2;
else if (pelletsRemaining < elroy1PelletCount) elroyLevel = 1;
else elroyLevel = 0;
if (elroyLevel != oldElroyLevel)
{
blinky.SetElroy(elroyLevel);
}
}
public void SetActive(bool active)
{
gameObject.SetActive(active);
foreach (Ghost ghost in ghosts)
{
ghost.SetActive(active);
}
}
public void SetKinematic(bool kinematic)
{
foreach (Ghost ghost in ghosts)
{
ghost.SetKinematic(kinematic);
}
}
public Ghost[] Ghosts
{
get => ghosts;
}
}
}

View File

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

View File

@@ -0,0 +1,26 @@
namespace Marro.PacManUdon
{
using System;
using UdonSharp;
using UnityEngine;
public abstract class GridMover : UdonSharpBehaviour
{
public virtual Vector2 GetPosition()
{
Debug.LogWarning($"{gameObject} does not implement GetPosition");
return Vector2.zero;
}
public virtual void SetPosition(Vector2 position)
{
Debug.LogWarning($"{gameObject} does not implement SetPosition");
}
public virtual Vector2 GetDirection()
{
Debug.LogWarning($"{gameObject} does not implement GetDirection");
return Vector2.zero;
}
}
}

View File

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

View File

@@ -0,0 +1,70 @@
namespace Marro.PacManUdon
{
using System;
using UnityEngine;
public static class GridMoverTools
{
public static Vector2 GetNextPosition(Vector2 currentPosition, Vector2 direction, float speed)
{
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)
{
return new Vector2((float)Math.Round(position.x), (float)Math.Round(position.y));
}
public static bool CrossesTileCenter(Vector2 currentPosition, Vector2 nextPosition, bool horizontal, bool vertical)
{
bool result = false;
if (horizontal)
{
result = result || Math.Floor(currentPosition.x) != Math.Floor(nextPosition.x);
}
if (vertical)
{
result = result || Math.Floor(currentPosition.y) != Math.Floor(nextPosition.y);
}
// Debug.Log($"CrossesTileCenter at currentPosition {currentPosition} with nextPosition {nextPosition}, horizontal {horizontal} and vertical {vertical} gives {result}");
return result;
}
public static bool CrossesTileBorder(Vector2 currentPosition, Vector2 nextPosition, bool horizontal, bool vertical)
{
bool result = false;
if (horizontal)
{
result = result || nextPosition.x != currentPosition.x
&& ((Math.Floor(currentPosition.x) != Math.Floor(nextPosition.x) && nextPosition.x % 1 != 0)
|| currentPosition.x % 1 == 0);
}
if (vertical)
{
result = result || nextPosition.y != currentPosition.y
&& ((Math.Floor(currentPosition.y) != Math.Floor(nextPosition.y) && nextPosition.y % 1 != 0)
|| currentPosition.y % 1 == 0);
}
return result;
}
public static bool CheckCollisionInDirection(Transform transform, Vector2 position, Vector2 direction)
{
// Debug.Log("Collision check");
bool result = Physics.Linecast(transform.parent.TransformPoint(position), transform.parent.TransformPoint(position + direction.normalized), 1 << 22, QueryTriggerInteraction.Ignore);
// Debug.DrawLine(transform.parent.TransformPoint(position), transform.parent.TransformPoint(position + direction.normalized), Color.red, 1);
// Debug.Log($"{gameObject} Collision; Position {position} became {transform.parent.TransformPoint(position)}, direction {direction.normalized} became {transform.parent.TransformDirection(direction.normalized)}");
// Debug.Log("collision check for " + position + " in direction " + direction + " returned " + result);
return result;
}
}
}

View File

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

View File

@@ -0,0 +1,106 @@
%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: LevelDisplay
m_EditorClassIdentifier:
serializedUdonProgramAsset: {fileID: 11400000, guid: 58308958314c3784db565b796186b973, type: 2}
udonAssembly:
assemblyError:
sourceCsScript: {fileID: 11500000, guid: bfb98761f8607ea448b750de3eb0e457, type: 3}
scriptVersion: 2
compiledVersion: 2
behaviourSyncMode: 0
hasInteractEvent: 0
scriptID: 1576460003420888666
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: levelDisplayDigits
- Name: $v
Entry: 7
Data: 2|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: levelDisplayDigits
- Name: <UserType>k__BackingField
Entry: 7
Data: 3|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: UnityEngine.Animator[], UnityEngine.AnimationModule
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 9
Data: 3
- 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: 4|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

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

View File

@@ -0,0 +1,26 @@
namespace Marro.PacManUdon
{
using UdonSharp;
using UnityEngine;
using VRC.SDK3.Data;
using VRC.SDKBase;
using VRC.Udon;
public class LevelDisplay : UdonSharpBehaviour
{
Animator[] levelDisplayDigits;
public void Initialize()
{
levelDisplayDigits = GetComponentsInChildren<Animator>();
}
public void SetLevel(int level)
{
for (int i = 0; i < levelDisplayDigits.Length; i++)
{
levelDisplayDigits[i].SetFloat("FruitType", PacManConstants.FruitTypeToValue(PacManConstants.GetFruitTypeForLevel(level - i)));
}
}
}
}

View File

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

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: c729f174a6377ca4dbf9c7c1a32c1bc7
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

286
Assets/Scripts/Maze.asset Normal file
View File

@@ -0,0 +1,286 @@
%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: Maze
m_EditorClassIdentifier:
serializedUdonProgramAsset: {fileID: 11400000, guid: c6d716f0cccb3494ab4fff1d2da78dac, type: 2}
udonAssembly:
assemblyError:
sourceCsScript: {fileID: 11500000, guid: b723069650d224f439f7f8d4f2e075d3, type: 3}
scriptVersion: 2
compiledVersion: 2
behaviourSyncMode: 0
hasInteractEvent: 0
scriptID: 8103042363885536712
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: 4
- Name:
Entry: 7
Data:
- Name: $k
Entry: 1
Data: mazeBoundaries
- Name: $v
Entry: 7
Data: 2|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: mazeBoundaries
- Name: <UserType>k__BackingField
Entry: 7
Data: 3|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: UnityEngine.Vector2, UnityEngine.CoreModule
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 9
Data: 3
- 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: 4|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 1
- Name:
Entry: 7
Data: 5|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: ghostTargets
- Name: $v
Entry: 7
Data: 6|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: ghostTargets
- Name: <UserType>k__BackingField
Entry: 7
Data: 7|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: UnityEngine.GameObject[], 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: pelletContainer
- Name: $v
Entry: 7
Data: 10|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: pelletContainer
- Name: <UserType>k__BackingField
Entry: 7
Data: 11|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: UnityEngine.GameObject, UnityEngine.CoreModule
- Name:
Entry: 8
Data:
- 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: 12|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 1
- Name:
Entry: 7
Data: 13|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: mazeSprite
- Name: $v
Entry: 7
Data: 14|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: mazeSprite
- 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:
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

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

15
Assets/Scripts/Maze.cs Normal file
View File

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

View File

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

1216
Assets/Scripts/PacMan.asset Normal file

File diff suppressed because it is too large Load Diff

View File

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

385
Assets/Scripts/PacMan.cs Normal file
View File

@@ -0,0 +1,385 @@
namespace Marro.PacManUdon
{
using System;
using UdonSharp;
using UnityEngine;
using VRC.SDKBase;
using VRC.Udon;
using VRC.SDK3.Components;
public class PacMan : GridMover
{
private GameController gameController;
private PlayerInput input;
private float defaultSpeed;
private float powerPelletSpeed;
private float speed;
private Vector3 startPosition;
private Quaternion startRotation;
private Vector3 startScale;
private Animator animator;
new Renderer renderer;
private VRCObjectPool pelletPool;
private bool hideUntilUnfrozen;
private bool dead;
private bool kinematic;
private bool followingPredefinedPath;
private Vector2[] predefinedPath;
private int predefinedPathIndex;
[UdonSynced] private Vector2 syncedPosition;
[UdonSynced] private Vector2 targetDirection;
[UdonSynced] private Vector2 direction;
[UdonSynced] private float freezeSeconds;
[UdonSynced] private bool frozen;
public void Initialize(PlayerInput input, VRCObjectPool pelletPool, GameController gameController)
{
this.gameController = gameController;
this.input = input;
this.pelletPool = pelletPool;
animator = GetComponent<Animator>();
renderer = GetComponent<Renderer>();
frozen = false;
hideUntilUnfrozen = false;
startPosition = transform.localPosition;
startRotation = transform.localRotation;
startScale = transform.localScale;
}
public void Reset()
{
// Debug.Log($"{gameObject} Reset!");
transform.localPosition = startPosition;
transform.localRotation = startRotation;
transform.localScale = startScale;
direction = Vector2.left;
targetDirection = Vector2.left;
speed = defaultSpeed;
kinematic = false;
followingPredefinedPath = false;
SetDead(false);
animator.SetTrigger("Reset");
}
void FixedUpdate()
{
// gameStateManager.statusDisplay.SetDebugText(1, this.targetDirection.ToString());
if (frozen)
{
return;
}
if (hideUntilUnfrozen)
{
hideUntilUnfrozen = false;
SetVisibility(true);
}
float speed = this.speed;
if (freezeSeconds > 0)
{
float freezePart = freezeSeconds / Time.deltaTime;
if (freezePart >= 1)
{
freezeSeconds -= Time.deltaTime;
animator.speed = 0;
return;
}
speed *= 1 - freezePart;
animator.speed = 1 - freezePart;
freezeSeconds = 0;
}
else
{
animator.speed = 1;
}
Vector2 position = GetPosition();
Vector2 nextPosition = GridMoverTools.GetNextPosition(position, direction, speed); // The position pacman will move to, assuming it doens't get changed
if (!kinematic)
{
if (followingPredefinedPath)
{
nextPosition = ProcessPredefinedPath(position, nextPosition);
}
else
{
nextPosition = ProcessNextPosition(position, nextPosition);
}
}
SetPosition(nextPosition);
}
private Vector2 ProcessNextPosition(Vector2 position, Vector2 nextPosition)
{
if (GridMoverTools.CrossesTileCenter(position, nextPosition, direction.x != 0, false) // If pacman is moving horizontally, check if he may cross the center of a tile in that axis
&& (targetDirection.x == 0 || GridMoverTools.CheckCollisionInDirection(transform, nextPosition, new Vector2(direction.x, 0))))
{ // If the target direction is in the other axis or if we're about to run into a wall
nextPosition.x = GridMoverTools.PositionToGrid(nextPosition).x; // Snap pacman to the center of his current tile in this axis
SetDirection(new Vector2(0, direction.y));
// Debug.Log($"{gameObject} crossed X tile center from {currentPosition}, nextPosition is now {nextPosition} and direction is now {direction}");
}
if (GridMoverTools.CrossesTileCenter(position, nextPosition, false, direction.y != 0) // See comments above but now vertical
&& (targetDirection.y == 0 || GridMoverTools.CheckCollisionInDirection(transform, nextPosition, new Vector2(0, direction.y))))
{
nextPosition.y = GridMoverTools.PositionToGrid(nextPosition).y;
SetDirection(new Vector2(direction.x, 0));
// 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();
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
&& !GridMoverTools.CheckCollisionInDirection(transform, nextPosition, inputDirection))
{ // Check if the requested direction does not have a wall
if (inputDirection.x != 0)
{ // Move in the requested direction, as well as perpundicular to it to get to the center of the tunnel
SetDirection(inputDirection + new Vector2(0, GridMoverTools.PositionToGrid(nextPosition).y - nextPosition.y).normalized);
}
else
{
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
}
}
return nextPosition;
}
private Vector2 ProcessPredefinedPath(Vector2 position, Vector2 nextPosition)
{
if (GridMoverTools.CrossesTileCenter(position, nextPosition, direction.x != 0, direction.y != 0))
{
// Find the next valid direction which isn't Vector2.zero
int nextValidDirectionIndex = predefinedPathIndex;
while (predefinedPath[nextValidDirectionIndex] == Vector2.zero)
{
nextValidDirectionIndex += 1;
}
if (!GridMoverTools.CheckCollisionInDirection(transform, nextPosition, predefinedPath[nextValidDirectionIndex]))
{
// If we're at a Vector2.zero, we skip applying the direction and only increment.
if (nextValidDirectionIndex == predefinedPathIndex)
{
SetDirection(predefinedPath[nextValidDirectionIndex]);
SetTargetDirection(predefinedPath[nextValidDirectionIndex]);
nextPosition = GridMoverTools.PositionToGrid(nextPosition) + direction.normalized * 0.01f;
// Check if we've reached the end of the path, which includes making sure the path doesn't end on Vector2.zero
do
{
nextValidDirectionIndex += 1;
if (nextValidDirectionIndex >= predefinedPath.Length)
{
followingPredefinedPath = false;
break;
}
} while (predefinedPath[nextValidDirectionIndex] == Vector2.zero);
}
// gameStateManager.statusDisplay.SetDebugText(1, predefinedPathIndex.ToString());
predefinedPathIndex++;
}
}
return nextPosition;
}
private void UpdateAnimator()
{
// Debug.Log($"{gameObject} UpdateAnimator with direction {direction}, dead {dead}, frozen {frozen}");
if (!gameObject.activeInHierarchy)
return;
animator.SetBool("Dead", dead);
if (dead)
{
animator.speed = 1;
return;
}
if (frozen || direction.Equals(Vector2.zero))
{
animator.SetFloat("Direction", 0f);
animator.speed = 0;
}
else
{
animator.speed = 1;
if (targetDirection.Equals(Vector2.right))
{
animator.SetFloat("Direction", 0.25f);
}
else if (targetDirection.Equals(Vector2.left))
{
animator.SetFloat("Direction", 0.5f);
}
else if (targetDirection.Equals(Vector2.up))
{
animator.SetFloat("Direction", 0.75f);
}
else if (targetDirection.Equals(Vector2.down))
{
animator.SetFloat("Direction", 1f);
}
}
}
// public Vector2 GetTarget(Vector2 gridPosition, Vector2 currentDirection) {
// Vector2 nextDirection = input.GetRotatedDirection();
// if(!nextDirection.Equals(currentDirection) && !GridMoverTools.CheckCollisionInDirection(transform, gridPosition, nextDirection)) {
// return nextDirection;
// }
// return Vector2.zero;
// }
public void SetDead(bool dead)
{
this.dead = dead;
UpdateAnimator();
}
public void SetFrozen(bool frozen)
{
this.frozen = frozen;
UpdateAnimator();
}
public void HideUntilUnfrozen()
{
hideUntilUnfrozen = true;
SetVisibility(false);
}
public void SetLevel(int level)
{
// Debug.Log($"{gameObject} SetLevel {level}");
defaultSpeed = PacManConstants.GetPacManDefaultSpeedForLevel(level);
powerPelletSpeed = PacManConstants.GetPacManPowerPelletSpeedForLevel(level);
}
public void SetPowerPellet(bool powerPellet)
{
if (powerPellet)
{
speed = powerPelletSpeed;
}
else
{
speed = defaultSpeed;
}
}
public void SetActive(bool active)
{
gameObject.SetActive(active);
renderer.enabled = active;
if (active)
{
UpdateAnimator();
}
}
public void SetKinematic(bool kinematic)
{
this.kinematic = kinematic;
}
public void SetPredefinedPath(Vector2[] predefinedPath)
{
this.predefinedPath = predefinedPath;
followingPredefinedPath = true;
predefinedPathIndex = 0;
}
void SetVisibility(bool 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)
{
this.targetDirection = targetDirection;
UpdateAnimator();
}
public override void OnPreSerialization()
{
syncedPosition = GetPosition();
}
public override void OnDeserialization()
{
SetPosition(syncedPosition);
UpdateAnimator();
}
void OnTriggerEnter(Collider other)
{
Pellet pellet = other.gameObject.GetComponent<Pellet>();
if (pellet)
{
if (Networking.IsOwner(gameObject))
{
pelletPool.Return(pellet.gameObject);
}
else
{
pellet.pelletRenderer.enabled = false;
pellet.gameObject.SetActive(false);
}
if (pellet.isPowerPellet)
{
if (Networking.IsOwner(gameObject)) gameController.GotPowerPellet();
freezeSeconds = 0.05f;
}
else
{
if (Networking.IsOwner(gameObject)) gameController.GotPellet();
freezeSeconds = 0.0166666666666667f;
}
if (Networking.IsOwner(gameObject)) RequestSerialization();
return;
}
else if (Networking.IsOwner(gameObject) && other.gameObject.GetComponent<BonusFruit>())
{
gameController.GotFruit();
}
}
}
}

View File

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

View File

@@ -0,0 +1,301 @@
namespace Marro.PacManUdon
{
using UnityEngine;
public enum PacManFruitType
{
None = -1,
Cherries = 0,
Strawberry = 1,
Peach = 2,
Apple = 3,
Grapes = 4,
Galaxian = 5,
Bell = 6,
Key = 7
}
public enum PacManGameState
{
AttractMode,
AttractModeDemo,
WaitForStart,
InGame,
}
public enum PacManGhostFrozenState
{
Frozen,
FrozenIfNotCaught,
NotFrozen
}
public enum PacManTimeSequence
{
AttractScreenIntroduction,
AttractScreenDemo,
WaitForStart,
WaitForStartTimeout,
StartNewGame,
BoardClear,
StartNewLevel,
GhostCaught,
PacManCaught,
RestartLevel,
GameOver
}
public static class PacManConstants
{
public static GameObject[] ComponentsToGameObjects(Component[] components, bool skipFirstComponent = false)
{
if (skipFirstComponent)
{
GameObject[] gameObjects = new GameObject[components.Length-1];
for (int i = 0; i < components.Length-1; i++)
{
gameObjects[i] = components[i+1].gameObject;
}
return gameObjects;
}
else
{
GameObject[] gameObjects = new GameObject[components.Length];
for (int i = 0; i < components.Length; i++)
{
gameObjects[i] = components[i].gameObject;
}
return gameObjects;
}
}
public static float GetPowerPelletBlinkToggleInterval()
{
return 0.1666666666f;
}
public static PacManFruitType GetFruitTypeForLevel(int level)
{
PacManFruitType[] FruitTypePerLevel = new PacManFruitType[]
{
PacManFruitType.Cherries,
PacManFruitType.Strawberry,
PacManFruitType.Peach,
PacManFruitType.Peach,
PacManFruitType.Apple,
PacManFruitType.Apple,
PacManFruitType.Grapes,
PacManFruitType.Grapes,
PacManFruitType.Galaxian,
PacManFruitType.Galaxian,
PacManFruitType.Bell,
PacManFruitType.Bell,
PacManFruitType.Key
};
if (level-1 < 0)
{
return PacManFruitType.None;
}
if (level-1 >= FruitTypePerLevel.Length)
{
return FruitTypePerLevel[FruitTypePerLevel.Length-1];
}
return FruitTypePerLevel[level-1];
}
public static float GetGhostHomeSpeed()
{
return 3.5f;
}
public static float GetPacManDefaultSpeedForLevel(int level)
{
if(level <= 1) return 7.576f;
if(level <= 4) return 8.523f;
if(level <= 20) return 9.470f;
return 8.523f;
}
public static float GetPacManPowerPelletSpeedForLevel(int level)
{
if(level <= 1) return 8.523f;
if(level <= 4) return 8.996f;
return 9.470f;
}
public static float GetGhostDefaultSpeedForLevel(int level)
{
if(level <= 1) return 7.102f;
if(level <= 4) return 8.049f;
return 8.996f;
}
public static float GetGhostTunnelSpeedForLevel(int level)
{
if(level <= 1) return 3.788f;
if(level <= 4) return 4.261f;
return 4.735f;
}
public static float GetBlinkyElroy1SpeedForLevel(int level)
{
if(level <= 1) return 7.576f;
if(level <= 4) return 8.523f;
return 9.470f;
}
public static float GetBlinkyElroy2SpeedForLevel(int level)
{
if(level <= 1) return 8.049f;
if(level <= 4) return 8.996f;
return 9.943f;
}
public static float GetGhostScaredSpeedForLevel(int level)
{
if(level <= 1) return 4.735f;
if(level <= 4) return 5.208f;
return 5.682f;
}
public static int GetElroy1PelletsRemainingForLevel(int level)
{
if(level <= 1) return 20;
if(level <= 2) return 30;
if(level <= 5) return 40;
if(level <= 8) return 50;
if(level <= 11) return 60;
if(level <= 14) return 80;
if(level <= 18) return 100;
return 120;
}
public static int GetElroy2PelletsRemainingForLevel(int level)
{
if(level <= 1) return 10;
if(level <= 2) return 15;
if(level <= 5) return 20;
if(level <= 8) return 25;
if(level <= 11) return 30;
if(level <= 14) return 40;
if(level <= 18) return 50;
return 60;
}
public static float GetGhostHousePelletTimeoutLimitForLevel(int level)
{
if(level <= 4) return 4;
return 3;
}
public static int[] GetGhostHousePrivatePelletCounterLimitForLevel(int level)
{
if(level <= 1) return new int[] { 0, 0, 30, 60};
if(level <= 2) return new int[] { 0, 0, 0, 50};
return new int[] { 0, 0, 0, 0};
}
public static float[] GetScatterPatternForLevel(int level)
{
if(level <= 1) return new float[] { 7, 27, 34, 54, 59, 79, 84 };
if(level <= 4) return new float[] { 7, 27, 34, 54, 59, 1092, 1092.0166667f};
return new float[] { 5, 25, 30, 50, 55, 1092, 1092.0166667f};
}
public static float GetScaredDurationForLevel(int level)
{
float[] scaredDurationPerLevel =
{
6,
5,
4,
3,
2,
5,
2,
2,
1,
5,
2,
1,
1,
3,
1,
1,
0,
1,
0
};
if (level-1 < 0)
{
return scaredDurationPerLevel[0];
}
if (level-1 >= scaredDurationPerLevel.Length)
{
return scaredDurationPerLevel[scaredDurationPerLevel.Length-1];
}
return scaredDurationPerLevel[level-1];
}
public static float GetScaredNumberOfFlashesForLevel(int level)
{
int[] scaredNumberOfFlashesPerLevel = new int[]
{
5,
5,
5,
5,
5,
5,
5,
5,
3,
5,
5,
3,
3,
5,
3,
3,
0,
3,
0
};
if (level-1 < 0)
{
return scaredNumberOfFlashesPerLevel[0];
}
if (level-1 >= scaredNumberOfFlashesPerLevel.Length)
{
return scaredNumberOfFlashesPerLevel[scaredNumberOfFlashesPerLevel.Length-1];
}
return scaredNumberOfFlashesPerLevel[level-1];
}
public static int FruitTypeToValue(PacManFruitType fruitType) { // I can't get casting from enum to int to work so this is a workaround
switch (fruitType)
{
default:
case PacManFruitType.None:
return -1;
case PacManFruitType.Cherries:
return 0;
case PacManFruitType.Strawberry:
return 1;
case PacManFruitType.Peach:
return 2;
case PacManFruitType.Apple:
return 3;
case PacManFruitType.Grapes:
return 4;
case PacManFruitType.Galaxian:
return 5;
case PacManFruitType.Bell:
return 6;
case PacManFruitType.Key:
return 7;
}
}
}
}

View File

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

166
Assets/Scripts/Pellet.asset Normal file
View File

@@ -0,0 +1,166 @@
%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: Pellet
m_EditorClassIdentifier:
serializedUdonProgramAsset: {fileID: 11400000, guid: 73c452ee082eb9a4aba3a8a5df64f712, type: 2}
udonAssembly:
assemblyError:
sourceCsScript: {fileID: 11500000, guid: ffdca15ba7165984980ff229e320dbd2, type: 3}
scriptVersion: 2
compiledVersion: 2
behaviourSyncMode: 0
hasInteractEvent: 0
scriptID: -1060273512654542538
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: 2
- Name:
Entry: 7
Data:
- Name: $k
Entry: 1
Data: isPowerPellet
- Name: $v
Entry: 7
Data: 2|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: isPowerPellet
- Name: <UserType>k__BackingField
Entry: 7
Data: 3|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: System.Boolean, mscorlib
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 9
Data: 3
- 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: 4|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 1
- Name:
Entry: 7
Data: 5|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: pelletRenderer
- Name: $v
Entry: 7
Data: 6|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: pelletRenderer
- Name: <UserType>k__BackingField
Entry: 7
Data: 7|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: UnityEngine.Renderer, 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: 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

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

16
Assets/Scripts/Pellet.cs Normal file
View File

@@ -0,0 +1,16 @@
namespace Marro.PacManUdon
{
using UdonSharp;
using UnityEngine;
public class Pellet : UdonSharpBehaviour
{
[SerializeField] public bool isPowerPellet = false;
public Renderer pelletRenderer;
void Start()
{
this.pelletRenderer = GetComponent<Renderer>();
}
}
}

View File

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

View File

@@ -0,0 +1,484 @@
%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: PelletManager
m_EditorClassIdentifier:
serializedUdonProgramAsset: {fileID: 11400000, guid: 9047ff9c4ab51104b8b0160387ad180b, type: 2}
udonAssembly:
assemblyError:
sourceCsScript: {fileID: 11500000, guid: 71c8438dc95de4c44896841f1fece6b9, type: 3}
scriptVersion: 2
compiledVersion: 2
behaviourSyncMode: 0
hasInteractEvent: 0
scriptID: 2205517818672966804
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: 8
- Name:
Entry: 7
Data:
- Name: $k
Entry: 1
Data: pellets
- Name: $v
Entry: 7
Data: 2|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: pellets
- 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: 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: pelletPool
- Name: $v
Entry: 7
Data: 7|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: pelletPool
- Name: <UserType>k__BackingField
Entry: 7
Data: 8|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: VRC.SDK3.Components.VRCObjectPool, VRCSDK3
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 9
Data: 8
- 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:
Entry: 13
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 7
Data:
- Name: $k
Entry: 1
Data: pelletRenderers
- Name: $v
Entry: 7
Data: 10|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: pelletRenderers
- Name: <UserType>k__BackingField
Entry: 7
Data: 11|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: UnityEngine.Renderer[], UnityEngine.CoreModule
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 9
Data: 11
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
- Name:
Entry: 6
Data:
- Name:
Entry: 8
Data:
- Name: <IsSerialized>k__BackingField
Entry: 5
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 12|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: powerPellets
- Name: $v
Entry: 7
Data: 13|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: powerPellets
- Name: <UserType>k__BackingField
Entry: 7
Data: 14|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: UnityEngine.Animator[], UnityEngine.AnimationModule
- Name:
Entry: 8
Data:
- 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: 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: powerPelletBlinkEnabled
- Name: $v
Entry: 7
Data: 16|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: powerPelletBlinkEnabled
- Name: <UserType>k__BackingField
Entry: 7
Data: 17|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: System.Boolean, mscorlib
- 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: powerPelletBlinkToggleInterval
- Name: $v
Entry: 7
Data: 19|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: powerPelletBlinkToggleInterval
- Name: <UserType>k__BackingField
Entry: 7
Data: 20|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: System.Single, mscorlib
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 9
Data: 20
- 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: 21|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: powerPelletBlinkProgress
- Name: $v
Entry: 7
Data: 22|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: powerPelletBlinkProgress
- Name: <UserType>k__BackingField
Entry: 9
Data: 20
- Name: <SystemType>k__BackingField
Entry: 9
Data: 20
- 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: 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: powerPelletBlinkCurrentlyVisible
- Name: $v
Entry: 7
Data: 24|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: powerPelletBlinkCurrentlyVisible
- Name: <UserType>k__BackingField
Entry: 9
Data: 17
- 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: 25|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

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

View File

@@ -0,0 +1,108 @@
namespace Marro.PacManUdon
{
using UdonSharp;
using UnityEngine;
using VRC.SDK3.Components;
using VRC.SDKBase;
using VRC.Udon;
public class PelletManager : UdonSharpBehaviour
{
[SerializeField] Pellet[] pellets;
VRCObjectPool pelletPool;
Renderer[] pelletRenderers;
Animator[] powerPellets;
bool powerPelletBlinkEnabled;
float powerPelletBlinkToggleInterval;
float powerPelletBlinkProgress;
bool powerPelletBlinkCurrentlyVisible;
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()
{
pelletRenderers = new Renderer[pellets.Length];
for (int i = 0; i < pelletRenderers.Length; i++)
{
pelletRenderers[i] = pellets[i].GetComponent<Renderer>();
}
powerPellets = GetComponentsInChildren<Animator>(true);
powerPelletBlinkToggleInterval = PacManConstants.GetPowerPelletBlinkToggleInterval();
SetPowerPelletsBlink(false);
}
void Update()
{
if (!powerPelletBlinkEnabled)
{
return;
}
powerPelletBlinkProgress += Time.deltaTime;
if (powerPelletBlinkProgress >= powerPelletBlinkToggleInterval)
{
// Debug.Log($"{gameObject} PowerPelletBlink toggle");
powerPelletBlinkProgress -= powerPelletBlinkToggleInterval;
powerPelletBlinkCurrentlyVisible = !powerPelletBlinkCurrentlyVisible;
SetPowerPelletsVisible(powerPelletBlinkCurrentlyVisible);
}
}
void SetPowerPelletsVisible(bool visible)
{
Debug.Log($"{gameObject} SetPowerPelletVisible {visible}, powerPellets.Length: {powerPellets.Length}");
foreach (Animator powerPellet in powerPellets)
{
powerPellet.SetBool("Visible", visible);
}
}
public void SetPowerPelletsBlink(bool enabled)
{
// Debug.Log($"{gameObject} SetPowerPelletBlink {enabled}");
powerPelletBlinkEnabled = enabled;
powerPelletBlinkCurrentlyVisible = true;
powerPelletBlinkProgress = 0;
SetPowerPelletsVisible(true);
}
public void FreezePowerPelletsBlink(bool frozen)
{
powerPelletBlinkEnabled = !frozen;
}
public void RestoreAllPellets()
{
foreach (GameObject pellet in pelletPool.Pool)
{
if (pelletPool.TryToSpawn() == false)
{
break;
}
}
foreach (Renderer pelletRenderer in pelletRenderers)
{
pelletRenderer.enabled = true;
}
}
}
}

View File

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

View File

@@ -0,0 +1,472 @@
%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: PlayerInput
m_EditorClassIdentifier:
serializedUdonProgramAsset: {fileID: 11400000, guid: 210029da340ce4c4991ecf6f5b23ff99, type: 2}
udonAssembly:
assemblyError:
sourceCsScript: {fileID: 11500000, guid: 2b80332b07bfc8843880210a6ea33710, type: 3}
scriptVersion: 2
compiledVersion: 2
behaviourSyncMode: 0
hasInteractEvent: 0
scriptID: -1932763587686248060
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: 8
- Name:
Entry: 7
Data:
- Name: $k
Entry: 1
Data: active
- Name: $v
Entry: 7
Data: 2|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: active
- Name: <UserType>k__BackingField
Entry: 7
Data: 3|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: System.Boolean, mscorlib
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 9
Data: 3
- 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: 4|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: gameController
- Name: $v
Entry: 7
Data: 5|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: gameController
- Name: <UserType>k__BackingField
Entry: 7
Data: 6|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: Marro.PacManUdon.GameController, Assembly-CSharp
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 7
Data: 7|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: false
- Name: _fieldAttributes
Entry: 7
Data: 8|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: inputHorizontal
- Name: $v
Entry: 7
Data: 9|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: inputHorizontal
- Name: <UserType>k__BackingField
Entry: 7
Data: 10|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: UnityEngine.Vector2, UnityEngine.CoreModule
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 9
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: 11|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: inputVertical
- Name: $v
Entry: 7
Data: 12|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: inputVertical
- Name: <UserType>k__BackingField
Entry: 9
Data: 10
- Name: <SystemType>k__BackingField
Entry: 9
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: 13|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: horizontalValue
- Name: $v
Entry: 7
Data: 14|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: horizontalValue
- Name: <UserType>k__BackingField
Entry: 7
Data: 15|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: System.Single, mscorlib
- Name:
Entry: 8
Data:
- 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: 16|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: verticalValue
- Name: $v
Entry: 7
Data: 17|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: verticalValue
- 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: 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: horizontalPriority
- Name: $v
Entry: 7
Data: 19|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: horizontalPriority
- Name: <UserType>k__BackingField
Entry: 9
Data: 3
- Name: <SystemType>k__BackingField
Entry: 9
Data: 3
- 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: player
- Name: $v
Entry: 7
Data: 21|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: player
- Name: <UserType>k__BackingField
Entry: 7
Data: 22|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: VRC.SDKBase.VRCPlayerApi, VRCSDKBase
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 9
Data: 22
- 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: 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: 13
Data:
- Name:
Entry: 8
Data:

View File

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

View File

@@ -0,0 +1,202 @@
namespace Marro.PacManUdon
{
using System;
using UdonSharp;
using UnityEngine;
using VRC.SDKBase;
using VRC.Udon;
using VRC.Udon.Common;
public class PlayerInput : UdonSharpBehaviour
{
public bool active;
private GameController gameController;
Vector2 inputHorizontal;
Vector2 inputVertical;
float horizontalValue;
float verticalValue;
bool horizontalPriority;
VRCPlayerApi player;
public void Initialize(GameController gameController)
{
this.gameController = gameController;
inputHorizontal = Vector2.zero;
inputVertical = Vector2.zero;
horizontalPriority = false;
player = Networking.LocalPlayer;
}
public void Activate()
{
Debug.Log($"{gameObject} got activated, {player} was immobilized");
active = true;
player.SetWalkSpeed(0);
player.SetRunSpeed(0);
player.SetStrafeSpeed(0);
gameController.JoystickGrabbed();
}
public void Deactivate()
{
Debug.Log($"{gameObject} got deactivated, {player} was released");
player.SetWalkSpeed(2);
player.SetRunSpeed(4);
player.SetStrafeSpeed(2);
active = false;
gameController.JoystickReleased();
}
public override void InputJump(bool pressed, UdonInputEventArgs args)
{
if (!active)
{
return;
}
if (pressed)
{
Deactivate();
}
}
public override void InputMoveHorizontal(float value, UdonInputEventArgs args)
{
if (!active)
{
return;
}
horizontalValue = Math.Abs(value);
if (value < -0.5)
{
inputHorizontal = Vector2.left;
if (horizontalValue >= verticalValue)
{
// horizontalPriority = true;
SetPriority(true);
}
}
else if (value > 0.5)
{
inputHorizontal = Vector2.right;
if (horizontalValue >= verticalValue)
{
// horizontalPriority = true;
SetPriority(true);
}
}
else
{
inputHorizontal = Vector2.zero;
// horizontalPriority = false;
SetPriority(false);
}
// Debug.Log("Horizontal Input Event: " + value + " | Direction: " + direction + " | lastDirection: " + lastDirection + " | Left: " + left + " | Right: " + right);
}
public override void InputMoveVertical(float value, UdonInputEventArgs args)
{
if (!active)
{
return;
}
verticalValue = Math.Abs(value);
if (value < -0.5)
{
inputVertical = Vector2.down;
if (verticalValue >= horizontalValue)
{
// horizontalPriority = false;
SetPriority(false);
}
}
else if (value > 0.5)
{
inputVertical = Vector2.up;
if (verticalValue >= horizontalValue)
{
// horizontalPriority = false;
SetPriority(false);
}
}
else
{
inputVertical = Vector2.zero;
// horizontalPriority = true;
SetPriority(true);
}
// Debug.Log("Vertical Input Event: " + value + " | Direction: " + direction + " | lastDirection : " + lastDirection);
}
private void SetPriority(bool horizontalPriority)
{
if (this.horizontalPriority != horizontalPriority)
{
player.PlayHapticEventInHand(VRC_Pickup.PickupHand.Left, 0.1f, 0.15f, 75);
this.horizontalPriority = horizontalPriority;
}
}
// public Vector2[] GetDirections() {
// return new Vector2[]{inputHorizontal, inputVertical};
// }
public Vector2 GetDirection()
{
if (horizontalPriority)
{
return inputHorizontal;
}
else
{
return inputVertical;
}
}
public void OverrideDirection(Vector2 direction) // For recording the demo only, should not be used when shipped as it is very much a hack
{
inputHorizontal = new Vector2(direction.x, direction.y);
horizontalPriority = true;
}
// public Vector2 GetRotatedDirection() {
// return RotateDirection(GetDirection(), rotation);
// }
// public Vector2 RotateDirection(Vector2 direction, int rotation) {
// rotation = rotation%4;
// // Debug.Log(direction + " " + rotation);
// switch(rotation) {
// default:
// return direction;
// case 1:
// return new Vector2(direction.y, -direction.x);
// case 2:
// return new Vector2(-direction.x, -direction.y);
// case 3:
// return new Vector2(-direction.y, direction.x);
// }
// }
// public override void InputLookHorizontal(float value, UdonInputEventArgs args)
// {
// float rotation = player.GetRotation().eulerAngles.y;
// if(rotation > 45 && rotation <= 135) {
// // Debug.Log("Right");
// this.rotation = 1;
// } else if(rotation > 135 && rotation <= 225) {
// // Debug.Log("Backward");
// this.rotation = 2;
// } else if(rotation > 225 && rotation <= 315) {
// // Debug.Log("Left");
// this.rotation = 3;
// } else if(rotation > 315 || rotation <= 45) {
// // Debug.Log("Forward");
// this.rotation = 0;
// }
// }
}
}

View File

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

View File

@@ -0,0 +1,52 @@
%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: PowerPellet
m_EditorClassIdentifier:
serializedUdonProgramAsset: {fileID: 11400000, guid: bc9582994932aa648bc02c914215e7cc, type: 2}
udonAssembly:
assemblyError:
sourceCsScript: {fileID: 11500000, guid: 55d0efe8af4dba540a508287baca6656, type: 3}
scriptVersion: 2
compiledVersion: 2
behaviourSyncMode: 0
hasInteractEvent: 0
scriptID: 7835090324168685075
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: 0
- Name:
Entry: 13
Data:
- Name:
Entry: 8
Data:

View File

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

View File

@@ -0,0 +1,12 @@
namespace Marro.PacManUdon
{
using UdonSharp;
public class PowerPellet : UdonSharpBehaviour
{
// Oh how I wish I could just have this method extend pellet and do things the normal way...
// But alas, with 'typeof', 'is' and overriding base fields all broken/not available I don't see a good way of differentiating between a type or its derivatives...
// The only reason I even want to use this class is so I can do GetComponentsInChildren<PowerPellet> instead of gathering all Pellets and then sorting through them.
// But since power pellets are the only pellets with animators, I'll probably just use GetComponentsInChildren<Animator> instead without further checking, since the animator is what I need to manipulate anyway.
}
}

View File

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

View File

@@ -0,0 +1,214 @@
%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: ScoreBonusDisplay
m_EditorClassIdentifier:
serializedUdonProgramAsset: {fileID: 11400000, guid: 9700246ac5b995c4a80efc21bb5d3cb8, type: 2}
udonAssembly:
assemblyError:
sourceCsScript: {fileID: 11500000, guid: 4022c09bf4b39054e9a1cd8598734fd8, type: 3}
scriptVersion: 2
compiledVersion: 2
behaviourSyncMode: 0
hasInteractEvent: 0
scriptID: 7990971396892945290
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: animator
- Name: $v
Entry: 7
Data: 2|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: animator
- Name: <UserType>k__BackingField
Entry: 7
Data: 3|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: UnityEngine.Animator, UnityEngine.AnimationModule
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 9
Data: 3
- 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: 4|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: countdownSeconds
- Name: $v
Entry: 7
Data: 5|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: countdownSeconds
- Name: <UserType>k__BackingField
Entry: 7
Data: 6|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: System.Single, mscorlib
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 9
Data: 6
- 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: 7|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: countingDown
- Name: $v
Entry: 7
Data: 8|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: countingDown
- Name: <UserType>k__BackingField
Entry: 7
Data: 9|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: System.Boolean, mscorlib
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 9
Data: 9
- 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: 10|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

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

View File

@@ -0,0 +1,52 @@
namespace Marro.PacManUdon
{
using UdonSharp;
using UnityEngine;
using VRC.SDKBase;
using VRC.Udon;
public class ScoreBonusDisplay : UdonSharpBehaviour
{
private Animator animator;
private float countdownSeconds;
private bool countingDown;
public void Initialize()
{
animator = GetComponent<Animator>();
countdownSeconds = 0;
countingDown = false;
gameObject.SetActive(false);
}
void Update()
{
if (countingDown)
{
countdownSeconds -= Time.deltaTime;
if (countdownSeconds <= 0)
{
Hide();
}
}
}
public void DisplayTemporarily(int score, int seconds)
{
Display(score);
countdownSeconds = seconds;
countingDown = true;
}
public void Display(int score)
{
gameObject.SetActive(true);
animator.SetFloat("Score", score);
}
public void Hide()
{
countingDown = false;
gameObject.SetActive(false);
}
}
}

View File

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

View File

@@ -0,0 +1,274 @@
%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: SoundManager
m_EditorClassIdentifier:
serializedUdonProgramAsset: {fileID: 11400000, guid: e48159421a020554fbc039a1c96e3ebd, type: 2}
udonAssembly:
assemblyError:
sourceCsScript: {fileID: 11500000, guid: 8b9538e55a089394e87f14eff80b2eb7, type: 3}
scriptVersion: 2
compiledVersion: 2
behaviourSyncMode: 0
hasInteractEvent: 0
scriptID: -159948094784737330
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: 4
- Name:
Entry: 7
Data:
- Name: $k
Entry: 1
Data: audioSourcePlayer
- Name: $v
Entry: 7
Data: 2|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: audioSourcePlayer
- Name: <UserType>k__BackingField
Entry: 7
Data: 3|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: UnityEngine.AudioSource, UnityEngine.AudioModule
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 9
Data: 3
- 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: 4|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 1
- Name:
Entry: 7
Data: 5|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: pacManDot1
- Name: $v
Entry: 7
Data: 6|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: pacManDot1
- Name: <UserType>k__BackingField
Entry: 7
Data: 7|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: UnityEngine.AudioClip, UnityEngine.AudioModule
- 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: pacManDot2
- Name: $v
Entry: 7
Data: 10|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: pacManDot2
- 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: nextDotSound
- Name: $v
Entry: 7
Data: 13|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: nextDotSound
- 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: 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: 13
Data:
- Name:
Entry: 8
Data:

View File

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

View File

@@ -0,0 +1,28 @@

using UdonSharp;
using UnityEngine;
using VRC.SDKBase;
using VRC.Udon;
public class SoundManager : UdonSharpBehaviour
{
[SerializeField] private AudioSource audioSourcePlayer;
[SerializeField] private AudioClip pacManDot1;
[SerializeField] private AudioClip pacManDot2;
private AudioClip nextDotSound;
public void Initialize()
{
nextDotSound = pacManDot2;
}
public void PlayPelletSound()
{
audioSourcePlayer.clip = nextDotSound;
audioSourcePlayer.Play();
nextDotSound = nextDotSound == pacManDot1 ? pacManDot2 : pacManDot1;
}
}

View File

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

File diff suppressed because it is too large Load Diff

View File

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

View File

@@ -0,0 +1,173 @@
namespace Marro.PacManUdon
{
using UdonSharp;
using UnityEngine;
using VRC.SDKBase;
using VRC.Udon;
using TMPro;
public class StatusDisplay : UdonSharpBehaviour
{
[SerializeField] private Transform scoreDisplayGroup;
[SerializeField] private TMP_Text label1UPText;
[SerializeField] private TMP_Text score1UPText;
[SerializeField] private TMP_Text labelHighScoreText;
[SerializeField] private TMP_Text scoreHighScoreText;
[SerializeField] private TMP_Text debugText;
[SerializeField] private TMP_Text debugText2;
[SerializeField] private TMP_Text gameOverText;
[SerializeField] private TMP_Text player1Text;
[SerializeField] private TMP_Text readyText;
[SerializeField] private Transform levelDisplayDigitsContainer;
[SerializeField] private Transform extraLifeIndicatorsContainer;
private Animator[] levelDisplayDigitAnimators;
private Renderer[] levelDisplayDigitRenderers;
private GameObject[] extraLifeIndicators;
private bool label1UPVisible;
private bool label1UPTextBlinking;
private float labelBlinkToggleInterval = 0.26666667f;
private float labelBlinkTimer;
public void Initialize()
{
// Level Display
levelDisplayDigitAnimators = levelDisplayDigitsContainer.GetComponentsInChildren<Animator>();
levelDisplayDigitRenderers = levelDisplayDigitsContainer.GetComponentsInChildren<Renderer>();
// Extra Lifes Display
Transform[] extraLifeIndicatorTransforms = extraLifeIndicatorsContainer.GetComponentsInChildren<Transform>();
extraLifeIndicators = new GameObject[extraLifeIndicatorTransforms.Length - 1];
for (int i = 1; i < extraLifeIndicatorTransforms.Length; i++) // We skip the first found components as it is the container and not an actual indicator
{
extraLifeIndicators[i - 1] = extraLifeIndicatorTransforms[i].gameObject;
}
Debug.Log($"{gameObject} extraLifeIndicators.Length: {extraLifeIndicators.Length}");
}
public void Reset()
{
SetLabel1UPTextBlinking(false);
}
void Update()
{
if (label1UPTextBlinking)
{
labelBlinkTimer += Time.deltaTime;
if (labelBlinkTimer > labelBlinkToggleInterval)
{
labelBlinkTimer -= labelBlinkToggleInterval;
SetLabel1UPTextVisible(!label1UPVisible);
}
}
}
public void Set1UPScore(int score)
{
if (score == 0)
{
score1UPText.text = "00";
}
else
{
score1UPText.text = score.ToString();
}
}
public void SetHighScore(int score)
{
if (score == 0)
{
scoreHighScoreText.text = "";
}
else
{
scoreHighScoreText.text = score.ToString();
}
}
public void SetDebugText(int debugTextLine, string text)
{
if (debugTextLine == 1)
{
debugText.text = text;
}
else if (debugTextLine == 2)
{
debugText2.text = text;
}
}
public void SetScoreDisplayVisible(bool visible)
{
scoreDisplayGroup.gameObject.SetActive(visible);
}
public void SetExtraLivesDisplayVisible(bool visible)
{
extraLifeIndicatorsContainer.gameObject.SetActive(visible);
}
public void SetLevelDisplayVisible(bool visible)
{
foreach (Renderer renderer in levelDisplayDigitRenderers)
{
renderer.enabled = visible;
}
}
public void SetGameOverTextVisible(bool visible)
{
gameOverText.gameObject.SetActive(visible);
}
public void SetReadyTextVisible(bool visible)
{
readyText.gameObject.SetActive(visible);
}
public void SetPlayer1TextVisible(bool visible)
{
player1Text.gameObject.SetActive(visible);
}
void SetLabel1UPTextVisible(bool visible)
{
label1UPVisible = visible;
label1UPText.gameObject.SetActive(visible);
}
public void SetLabel1UPTextBlinking(bool blinking)
{
SetLabel1UPTextVisible(false);
labelBlinkTimer = 0;
label1UPTextBlinking = blinking;
if (blinking == false)
{
SetLabel1UPTextVisible(true);
}
}
public bool SetExtraLives(int extraLives)
{
// Debug.Log($"{gameObject} SetExtraLives: {extraLives}");
for (int extraLifeIndicatorIndex = 0; extraLifeIndicatorIndex < extraLifeIndicators.Length; extraLifeIndicatorIndex++)
{
extraLifeIndicators[extraLifeIndicatorIndex].SetActive(extraLifeIndicatorIndex < extraLives);
}
return true;
}
public void SetLevel(int level)
{
for (int i = 0; i < levelDisplayDigitAnimators.Length; i++)
{
levelDisplayDigitAnimators[i].SetFloat("FruitType", PacManConstants.FruitTypeToValue(PacManConstants.GetFruitTypeForLevel(level - i)));
}
}
}
}

View File

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

View File

@@ -0,0 +1,178 @@
%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: Teleporter
m_EditorClassIdentifier:
serializedUdonProgramAsset: {fileID: 11400000, guid: 1589eb7cce8925e4da3272208dfa87f4, type: 2}
udonAssembly:
assemblyError:
sourceCsScript: {fileID: 11500000, guid: aae1c5d18ae01b3488b54c72e6f1edf6, type: 3}
scriptVersion: 2
compiledVersion: 2
behaviourSyncMode: 0
hasInteractEvent: 0
scriptID: -7788394196284941649
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: 2
- Name:
Entry: 7
Data:
- Name: $k
Entry: 1
Data: direction
- Name: $v
Entry: 7
Data: 2|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: direction
- Name: <UserType>k__BackingField
Entry: 7
Data: 3|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: Marro.PacManUdon.Direction, Assembly-CSharp
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 7
Data: 4|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: 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: target
- Name: $v
Entry: 7
Data: 7|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: target
- Name: <UserType>k__BackingField
Entry: 7
Data: 8|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: UnityEngine.Transform, UnityEngine.CoreModule
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 9
Data: 8
- 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: 9|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 1
- Name:
Entry: 7
Data: 10|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

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

View File

@@ -0,0 +1,63 @@
namespace Marro.PacManUdon
{
using UdonSharp;
using UnityEngine;
using VRC.SDKBase;
using VRC.Udon;
enum Direction
{
Any,
Up,
Left,
Down,
Right
}
public class Teleporter : UdonSharpBehaviour
{
[SerializeField] private Direction direction = Direction.Any;
[SerializeField] private Transform target;
void OnTriggerEnter(Collider other)
{
GridMover gridMover = other.gameObject.GetComponent<GridMover>();
if (gridMover == null)
{
return;
}
switch (direction)
{
case Direction.Up:
if (gridMover.GetDirection().y < 0)
{
return;
}
break;
case Direction.Down:
if (gridMover.GetDirection().y > 0)
{
return;
}
break;
case Direction.Left:
if (gridMover.GetDirection().x > 0)
{
return;
}
break;
case Direction.Right:
if (gridMover.GetDirection().x < 0)
{
return;
}
break;
default:
break;
}
gridMover.SetPosition(gridMover.GetPosition() + (Vector2)(target.localPosition - transform.localPosition));
}
}
}

View File

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

Some files were not shown because too many files have changed in this diff Show More