Compare commits

...

7 Commits

Author SHA1 Message Date
3be8d2f6a6 Fixed PacMan speed 2026-06-23 18:18:17 +02:00
875d0ad5f0 Fixed pellet sync 2026-06-23 14:45:30 +02:00
378d6bc7a7 Refactored input 2026-06-23 13:00:48 +02:00
540cfe16ab Amend 2026-06-22 18:50:26 +02:00
b688b4739b More better sync 2026-06-22 18:44:53 +02:00
1252933ca4 Improving sync 2026-06-22 18:31:16 +02:00
d6b870de79 SoundManager sync 2026-06-22 16:03:46 +02:00
17 changed files with 1262 additions and 929 deletions

View File

@@ -459,7 +459,8 @@ Transform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 1470248941}
- {fileID: 962437701}
- {fileID: 1772674898}
m_Father: {fileID: 1886023632}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &107806787
@@ -3171,6 +3172,37 @@ Transform:
m_Children: []
m_Father: {fileID: 712073434}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &571802606
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 571802607}
m_Layer: 0
m_Name: High score persistance
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &571802607
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 571802606}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 851913432}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &573616886 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 184438965336248073, guid: 15ac0ed4c56c7784ea3ae9000fc2af1f, type: 3}
@@ -4138,7 +4170,7 @@ MonoBehaviour:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 805005470}
m_Enabled: 0
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 45115577ef41a5b4ca741ed302693907, type: 3}
m_Name:
@@ -4163,7 +4195,7 @@ MonoBehaviour:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 805005470}
m_Enabled: 0
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: cbbf384cde136444d9f640ff9f3445cf, type: 3}
m_Name:
@@ -4190,6 +4222,37 @@ GameObject:
m_CorrespondingSourceObject: {fileID: 1928664601999823222, guid: 15ac0ed4c56c7784ea3ae9000fc2af1f, type: 3}
m_PrefabInstance: {fileID: 7528894854307259292}
m_PrefabAsset: {fileID: 0}
--- !u!1 &806335367
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 806335368}
m_Layer: 0
m_Name: Instance high score
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &806335368
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 806335367}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 851913432}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &806693070 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 4795217970421011192, guid: 15ac0ed4c56c7784ea3ae9000fc2af1f, type: 3}
@@ -4405,7 +4468,9 @@ Transform:
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Children:
- {fileID: 571802607}
- {fileID: 806335368}
m_Father: {fileID: 1886023632}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &859475370 stripped
@@ -4550,6 +4615,37 @@ GameObject:
m_CorrespondingSourceObject: {fileID: 8648916981024671211, guid: 15ac0ed4c56c7784ea3ae9000fc2af1f, type: 3}
m_PrefabInstance: {fileID: 1210508488}
m_PrefabAsset: {fileID: 0}
--- !u!1 &962437700
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 962437701}
m_Layer: 0
m_Name: Repair demo
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &962437701
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 962437700}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 106401850}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &962831748 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 4432432907462793590, guid: 15ac0ed4c56c7784ea3ae9000fc2af1f, type: 3}
@@ -8211,6 +8307,7 @@ Transform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 1470248941}
- {fileID: 991830906}
- {fileID: 791132292}
- {fileID: 2130594149}
@@ -8463,12 +8560,12 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1470248940}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 106401850}
m_Father: {fileID: 1438618203}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1472000832 stripped
GameObject:
@@ -12087,6 +12184,37 @@ GameObject:
m_CorrespondingSourceObject: {fileID: 8413102315728467232, guid: 15ac0ed4c56c7784ea3ae9000fc2af1f, type: 3}
m_PrefabInstance: {fileID: 1210508488}
m_PrefabAsset: {fileID: 0}
--- !u!1 &1772674897
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1772674898}
m_Layer: 0
m_Name: Repair other cutscenes
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &1772674898
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1772674897}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 106401850}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1773753006 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 7955628641985366373, guid: 15ac0ed4c56c7784ea3ae9000fc2af1f, type: 3}

View File

@@ -217,7 +217,7 @@ namespace Marro.PacManUdon
{
var active = (syncedPelletsCollected[i/8] & (byte)(1 << i%8)) == 0;
pellets[i].gameObject.SetActive(active);
pelletMap[pelletIndices[i]] = i;
pelletMap[pelletIndices[i]] = active ? i : (byte)PacManConsumableType.None;
}
}
#endregion
@@ -267,7 +267,7 @@ namespace Marro.PacManUdon
public override void CollectSyncedData(byte[] data, ref int index, NetworkEventType eventType)
{
data.Append((byte)pelletCollectedCount, ref index);
data.Append(pelletCollectedCount, ref index);
data.Append(syncedPelletsCollected, ref index);
data.Append(frozen, ref index);

View File

@@ -43,7 +43,7 @@ MonoBehaviour:
Data:
- Name:
Entry: 12
Data: 34
Data: 33
- Name:
Entry: 7
Data:
@@ -1078,25 +1078,25 @@ MonoBehaviour:
Data:
- Name: $k
Entry: 1
Data: demo
Data: soundManager
- Name: $v
Entry: 7
Data: 65|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: demo
Data: soundManager
- Name: <UserType>k__BackingField
Entry: 7
Data: 66|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: UnityEngine.Animator, UnityEngine.AnimationModule
Data: SoundManager, Assembly-CSharp
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 9
Data: 66
Data: 4
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -1136,72 +1136,12 @@ MonoBehaviour:
- Name:
Entry: 7
Data:
- Name: $k
Entry: 1
Data: soundManager
- Name: $v
Entry: 7
Data: 69|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: soundManager
- Name: <UserType>k__BackingField
Entry: 7
Data: 70|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: SoundManager, Assembly-CSharp
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 9
Data: 4
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
- Name:
Entry: 6
Data:
- Name:
Entry: 8
Data:
- Name: <IsSerialized>k__BackingField
Entry: 5
Data: true
- Name: _fieldAttributes
Entry: 7
Data: 71|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 1
- Name:
Entry: 7
Data: 72|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: networkManagerSetup
- Name: $v
Entry: 7
Data: 73|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
Data: 69|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: networkManagerSetup
@@ -1225,13 +1165,13 @@ MonoBehaviour:
Data: true
- Name: _fieldAttributes
Entry: 7
Data: 74|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
Data: 70|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 1
- Name:
Entry: 7
Data: 75|UnityEngine.SerializeField, UnityEngine.CoreModule
Data: 71|UnityEngine.SerializeField, UnityEngine.CoreModule
- Name:
Entry: 8
Data:
@@ -1255,7 +1195,7 @@ MonoBehaviour:
Data: recorder
- Name: $v
Entry: 7
Data: 76|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
Data: 72|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: recorder
@@ -1279,10 +1219,73 @@ MonoBehaviour:
Data: true
- Name: _fieldAttributes
Entry: 7
Data: 77|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
Data: 73|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 1
- Name:
Entry: 7
Data: 74|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: startingExtraLives
- Name: $v
Entry: 7
Data: 75|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: startingExtraLives
- 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: true
- Name: _fieldAttributes
Entry: 7
Data: 76|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 2
- Name:
Entry: 7
Data: 77|UnityEngine.HeaderAttribute, UnityEngine.CoreModule
- Name: header
Entry: 1
Data: Game settings
- Name:
Entry: 8
Data:
- Name:
Entry: 7
Data: 78|UnityEngine.SerializeField, UnityEngine.CoreModule
@@ -1306,13 +1309,13 @@ MonoBehaviour:
Data:
- Name: $k
Entry: 1
Data: startingExtraLives
Data: scoreToExtraLife
- Name: $v
Entry: 7
Data: 79|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: startingExtraLives
Data: scoreToExtraLife
- Name: <UserType>k__BackingField
Entry: 9
Data: 15
@@ -1334,75 +1337,12 @@ MonoBehaviour:
- Name: _fieldAttributes
Entry: 7
Data: 80|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 2
- Name:
Entry: 7
Data: 81|UnityEngine.HeaderAttribute, UnityEngine.CoreModule
- Name: header
Entry: 1
Data: Game settings
- Name:
Entry: 8
Data:
- Name:
Entry: 7
Data: 82|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: scoreToExtraLife
- Name: $v
Entry: 7
Data: 83|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: scoreToExtraLife
- 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: true
- Name: _fieldAttributes
Entry: 7
Data: 84|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 1
- Name:
Entry: 7
Data: 85|UnityEngine.SerializeField, UnityEngine.CoreModule
Data: 81|UnityEngine.SerializeField, UnityEngine.CoreModule
- Name:
Entry: 8
Data:
@@ -1426,13 +1366,13 @@ MonoBehaviour:
Data: maze
- Name: $v
Entry: 7
Data: 86|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
Data: 82|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: maze
- Name: <UserType>k__BackingField
Entry: 7
Data: 87|System.RuntimeType, mscorlib
Data: 83|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: Marro.PacManUdon.Maze, Assembly-CSharp
@@ -1456,7 +1396,7 @@ MonoBehaviour:
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 88|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
Data: 84|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 0
@@ -1480,13 +1420,13 @@ MonoBehaviour:
Data: intermission2Pole
- Name: $v
Entry: 7
Data: 89|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
Data: 85|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: intermission2Pole
- Name: <UserType>k__BackingField
Entry: 7
Data: 90|System.RuntimeType, mscorlib
Data: 86|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: Marro.PacManUdon.Intermission2Pole, Assembly-CSharp
@@ -1510,7 +1450,7 @@ MonoBehaviour:
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 91|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
Data: 87|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 0
@@ -1534,16 +1474,76 @@ MonoBehaviour:
Data: mazeSpriteAnimator
- Name: $v
Entry: 7
Data: 92|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
Data: 88|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: mazeSpriteAnimator
- Name: <UserType>k__BackingField
Entry: 9
Data: 66
Entry: 7
Data: 89|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: UnityEngine.Animator, UnityEngine.AnimationModule
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 9
Data: 66
Data: 89
- 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: 90|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: attractScreenElements
- Name: $v
Entry: 7
Data: 91|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: attractScreenElements
- Name: <UserType>k__BackingField
Entry: 7
Data: 92|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: UnityEngine.GameObject[], UnityEngine.CoreModule
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 9
Data: 92
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -1579,25 +1579,19 @@ MonoBehaviour:
Data:
- Name: $k
Entry: 1
Data: attractScreenElements
Data: intermissionScreenElements
- Name: $v
Entry: 7
Data: 94|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: attractScreenElements
Data: intermissionScreenElements
- Name: <UserType>k__BackingField
Entry: 7
Data: 95|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: UnityEngine.GameObject[], UnityEngine.CoreModule
- Name:
Entry: 8
Data:
Entry: 9
Data: 92
- Name: <SystemType>k__BackingField
Entry: 9
Data: 95
Data: 92
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -1612,7 +1606,7 @@ MonoBehaviour:
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 96|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
Data: 95|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 0
@@ -1633,19 +1627,25 @@ MonoBehaviour:
Data:
- Name: $k
Entry: 1
Data: intermissionScreenElements
Data: gameState
- Name: $v
Entry: 7
Data: 97|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
Data: 96|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: intermissionScreenElements
Data: gameState
- Name: <UserType>k__BackingField
Entry: 9
Data: 95
Entry: 7
Data: 97|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: Marro.PacManUdon.PacManGameState, Assembly-CSharp
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 9
Data: 95
Data: 15
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -1681,65 +1681,10 @@ MonoBehaviour:
Data:
- Name: $k
Entry: 1
Data: gameState
Data: score
- Name: $v
Entry: 7
Data: 99|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: gameState
- Name: <UserType>k__BackingField
Entry: 7
Data: 100|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: Marro.PacManUdon.PacManGameState, Assembly-CSharp
- 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: 101|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: score
- Name: $v
Entry: 7
Data: 102|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: score
@@ -1763,7 +1708,7 @@ MonoBehaviour:
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 103|System.Collections.Generic.List`1[[System.Attribute, mscorlib]],
Data: 100|System.Collections.Generic.List`1[[System.Attribute, mscorlib]],
mscorlib
- Name:
Entry: 12
@@ -1788,7 +1733,7 @@ MonoBehaviour:
Data: level
- Name: $v
Entry: 7
Data: 104|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
Data: 101|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: level
@@ -1812,7 +1757,7 @@ MonoBehaviour:
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 105|System.Collections.Generic.List`1[[System.Attribute, mscorlib]],
Data: 102|System.Collections.Generic.List`1[[System.Attribute, mscorlib]],
mscorlib
- Name:
Entry: 12
@@ -1837,7 +1782,7 @@ MonoBehaviour:
Data: highScore
- Name: $v
Entry: 7
Data: 106|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
Data: 103|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: highScore
@@ -1861,7 +1806,7 @@ MonoBehaviour:
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 107|System.Collections.Generic.List`1[[System.Attribute, mscorlib]],
Data: 104|System.Collections.Generic.List`1[[System.Attribute, mscorlib]],
mscorlib
- Name:
Entry: 12
@@ -1886,7 +1831,7 @@ MonoBehaviour:
Data: extraLives
- Name: $v
Entry: 7
Data: 108|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
Data: 105|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: extraLives
@@ -1910,7 +1855,7 @@ MonoBehaviour:
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 109|System.Collections.Generic.List`1[[System.Attribute, mscorlib]],
Data: 106|System.Collections.Generic.List`1[[System.Attribute, mscorlib]],
mscorlib
- Name:
Entry: 12

View File

@@ -16,7 +16,6 @@ namespace Marro.PacManUdon
[SerializeField] private GameObject intermissionScreen;
[SerializeField] private GameObject pressStartButtonScreen;
[SerializeField] private PlayerInput playerInput;
[SerializeField] private Animator demo;
[SerializeField] private SoundManager soundManager;
[SerializeField] private NetworkManager networkManagerSetup;
@@ -107,7 +106,7 @@ namespace Marro.PacManUdon
Debug.Log($"{gameObject} Start Game Button was pressed!");
if (networkManager.IsOwner)
{
networkManager.SendEventNow(NetworkEventType.StartGameButtonPressed);
networkManager.SendEventSoon(NetworkEventType.StartGameButtonPressed, false);
}
StartTimeSequence(PacManTimeSequence.StartNewGame);
}
@@ -143,6 +142,7 @@ namespace Marro.PacManUdon
bonusFruit.Despawn();
soundManager.Reset();
collisionManager.Reset();
statusDisplay.Reset();
}
private void PrepareForCutscene()
@@ -263,7 +263,6 @@ namespace Marro.PacManUdon
statusDisplay.SetLevelDisplayVisible(false);
statusDisplay.SetPlayer1TextVisible(false);
statusDisplay.SetReadyTextVisible(false);
demo.gameObject.SetActive(false);
}
void SetPelletsActive(bool active)
@@ -373,6 +372,27 @@ namespace Marro.PacManUdon
soundManager.PlayExtraLifeSound();
}
private void SetupInGameState()
{
gameState = PacManGameState.InGame;
attractScreen.gameObject.SetActive(false);
SetPelletsActive(true);
SetMazeVisible(true);
SetGhostsActive(true);
SetPacManActive(true);
statusDisplay.SetExtraLivesDisplayVisible(true);
statusDisplay.SetLevelDisplayVisible(true);
statusDisplay.SetLabel1UPTextBlinking(true);
soundManager.SuppressSound(false);
soundManager.StartGhostSound();
SetFrozen(false);
}
public void SetFrozen(bool frozen, bool ghostIgnoreIfCaught = false, bool ghostKeepAnimating = false)
{
// Debug.Log($"{gameObject} Set Frozen: {frozen}");
@@ -389,6 +409,12 @@ namespace Marro.PacManUdon
return;
}
data.Append(gameState == PacManGameState.InGame, ref index);
data.AppendAsByte(level, ref index);
data.Append(score, ref index);
data.AppendAsByte(extraLives, ref index);
data.Append(currentlyInTimeSequence, ref index);
if (currentlyInTimeSequence)
@@ -397,10 +423,6 @@ namespace Marro.PacManUdon
data.Append(timeSequenceSecondsPassed, ref index);
}
data.AppendAsByte(level, ref index);
data.Append(score, ref index);
data.AppendAsByte(extraLives, ref index);
bonusFruit.CollectSyncedData(data, ref index, eventType);
collisionManager.CollectSyncedData(data, ref index, eventType);
@@ -408,6 +430,8 @@ namespace Marro.PacManUdon
ghostManager.CollectSyncedData(data, ref index, eventType);
pacMan.CollectSyncedData(data, ref index, eventType);
soundManager.CollectSyncedData(data, ref index, eventType);
}
public override bool WriteSyncedData(byte[] data, ref int index, NetworkEventType eventType)
@@ -423,22 +447,31 @@ namespace Marro.PacManUdon
return true;
}
var currentlyInTimeSequence = data.ReadBool(ref index);
if (currentlyInTimeSequence)
// If we're currently in-game, we'll need to make sure the state is setup correctly
var remoteCurrentlyInGame = data.ReadBool(ref index);
if (remoteCurrentlyInGame)
{
var currentTimeSequence = (PacManTimeSequence)data.ReadByte(ref index);
var timeSequenceSecondsPassed = data.ReadFloat(ref index);
TimeSequenceSyncWithRemote(currentTimeSequence, timeSequenceSecondsPassed);
}
else
{
TimeSequenceTryEndCurrent();
currentlyInTimeSequence = false; // Kill the current time sequence, otherwise it might interfere
// No need to run it to completion since we're overriding all state
SetupInGameState();
}
SetLevel(data.ReadByte(ref index));
SetScore(data.ReadInt(ref index));
SetExtraLives(data.ReadByte(ref index));
// Sync up with the remote's time sequence
var remoteCurrentlyInTimeSequence = data.ReadBool(ref index);
if (remoteCurrentlyInTimeSequence)
{
var currentTimeSequence = (PacManTimeSequence)data.ReadByte(ref index);
var timeSequenceSecondsPassed = data.ReadFloat(ref index);
TimeSequenceSyncWithRemote(currentTimeSequence, timeSequenceSecondsPassed);
}
// Note that we don't have any logic for if the remote is not in-game and not in a time sequence.
// Such a state should be impossible.
bonusFruit.WriteSyncedData(data, ref index, eventType);
collisionManager.WriteSyncedData(data, ref index, eventType);
@@ -447,6 +480,8 @@ namespace Marro.PacManUdon
pacMan.WriteSyncedData(data, ref index, eventType);
soundManager.WriteSyncedData(data, ref index, eventType);
return true;
}

View File

@@ -43,7 +43,7 @@ MonoBehaviour:
Data:
- Name:
Entry: 12
Data: 44
Data: 45
- Name:
Entry: 7
Data:
@@ -1525,13 +1525,13 @@ MonoBehaviour:
Data:
- Name: $k
Entry: 1
Data: scattering
Data: whiteScared
- Name: $v
Entry: 7
Data: 80|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: scattering
Data: whiteScared
- Name: <UserType>k__BackingField
Entry: 9
Data: 64
@@ -1573,25 +1573,19 @@ MonoBehaviour:
Data:
- Name: $k
Entry: 1
Data: frozenState
Data: scattering
- Name: $v
Entry: 7
Data: 82|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: frozenState
Data: scattering
- Name: <UserType>k__BackingField
Entry: 7
Data: 83|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: Marro.PacManUdon.PacManGhostFrozenState, Assembly-CSharp
- Name:
Entry: 8
Data:
Entry: 9
Data: 64
- Name: <SystemType>k__BackingField
Entry: 9
Data: 11
Data: 64
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -1606,7 +1600,7 @@ MonoBehaviour:
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 84|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
Data: 83|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 0
@@ -1627,19 +1621,25 @@ MonoBehaviour:
Data:
- Name: $k
Entry: 1
Data: offGrid
Data: frozenState
- Name: $v
Entry: 7
Data: 85|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
Data: 84|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: offGrid
Data: frozenState
- Name: <UserType>k__BackingField
Entry: 9
Data: 64
Entry: 7
Data: 85|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: Marro.PacManUdon.PacManGhostFrozenState, Assembly-CSharp
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 9
Data: 64
Data: 11
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -1675,19 +1675,19 @@ MonoBehaviour:
Data:
- Name: $k
Entry: 1
Data: housePelletCounter
Data: offGrid
- Name: $v
Entry: 7
Data: 87|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: housePelletCounter
Data: offGrid
- Name: <UserType>k__BackingField
Entry: 9
Data: 11
Data: 64
- Name: <SystemType>k__BackingField
Entry: 9
Data: 11
Data: 64
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -1723,19 +1723,19 @@ MonoBehaviour:
Data:
- Name: $k
Entry: 1
Data: housePelletCounterActive
Data: housePelletCounter
- Name: $v
Entry: 7
Data: 89|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: housePelletCounterActive
Data: housePelletCounter
- Name: <UserType>k__BackingField
Entry: 9
Data: 64
Data: 11
- Name: <SystemType>k__BackingField
Entry: 9
Data: 64
Data: 11
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -1771,19 +1771,19 @@ MonoBehaviour:
Data:
- Name: $k
Entry: 1
Data: housePelletCounterLimit
Data: housePelletCounterActive
- Name: $v
Entry: 7
Data: 91|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: housePelletCounterLimit
Data: housePelletCounterActive
- Name: <UserType>k__BackingField
Entry: 9
Data: 11
Data: 64
- Name: <SystemType>k__BackingField
Entry: 9
Data: 11
Data: 64
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -1819,19 +1819,19 @@ MonoBehaviour:
Data:
- Name: $k
Entry: 1
Data: kinematic
Data: housePelletCounterLimit
- Name: $v
Entry: 7
Data: 93|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: kinematic
Data: housePelletCounterLimit
- Name: <UserType>k__BackingField
Entry: 9
Data: 64
Data: 11
- Name: <SystemType>k__BackingField
Entry: 9
Data: 64
Data: 11
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -1867,13 +1867,13 @@ MonoBehaviour:
Data:
- Name: $k
Entry: 1
Data: specialLook
Data: kinematic
- Name: $v
Entry: 7
Data: 95|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: specialLook
Data: kinematic
- Name: <UserType>k__BackingField
Entry: 9
Data: 64
@@ -1915,13 +1915,13 @@ MonoBehaviour:
Data:
- Name: $k
Entry: 1
Data: followingPredefinedPath
Data: specialLook
- Name: $v
Entry: 7
Data: 97|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: followingPredefinedPath
Data: specialLook
- Name: <UserType>k__BackingField
Entry: 9
Data: 64
@@ -1963,31 +1963,19 @@ MonoBehaviour:
Data:
- Name: $k
Entry: 1
Data: predefinedPath
Data: followingPredefinedPath
- Name: $v
Entry: 7
Data: 99|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: predefinedPath
Data: followingPredefinedPath
- Name: <UserType>k__BackingField
Entry: 7
Data: 100|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: Marro.PacManUdon.Direction[], Assembly-CSharp
- Name:
Entry: 8
Data:
Entry: 9
Data: 64
- Name: <SystemType>k__BackingField
Entry: 7
Data: 101|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: System.Int32[], mscorlib
- Name:
Entry: 8
Data:
Entry: 9
Data: 64
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -2002,7 +1990,7 @@ MonoBehaviour:
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 102|System.Collections.Generic.List`1[[System.Attribute, mscorlib]],
Data: 100|System.Collections.Generic.List`1[[System.Attribute, mscorlib]],
mscorlib
- Name:
Entry: 12
@@ -2024,19 +2012,31 @@ MonoBehaviour:
Data:
- Name: $k
Entry: 1
Data: predefinedPathIndex
Data: predefinedPath
- Name: $v
Entry: 7
Data: 103|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
Data: 101|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: predefinedPathIndex
Data: predefinedPath
- Name: <UserType>k__BackingField
Entry: 9
Data: 11
Entry: 7
Data: 102|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: Marro.PacManUdon.Direction[], Assembly-CSharp
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 9
Data: 11
Entry: 7
Data: 103|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
@@ -2073,13 +2073,13 @@ MonoBehaviour:
Data:
- Name: $k
Entry: 1
Data: <Index>k__BackingField
Data: predefinedPathIndex
- Name: $v
Entry: 7
Data: 105|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: <Index>k__BackingField
Data: predefinedPathIndex
- Name: <UserType>k__BackingField
Entry: 9
Data: 11
@@ -2122,13 +2122,13 @@ MonoBehaviour:
Data:
- Name: $k
Entry: 1
Data: animatorKeyDirection
Data: <Index>k__BackingField
- Name: $v
Entry: 7
Data: 107|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: animatorKeyDirection
Data: <Index>k__BackingField
- Name: <UserType>k__BackingField
Entry: 9
Data: 11
@@ -2171,13 +2171,13 @@ MonoBehaviour:
Data:
- Name: $k
Entry: 1
Data: animatorKeyGhostType
Data: animatorKeyDirection
- Name: $v
Entry: 7
Data: 109|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: animatorKeyGhostType
Data: animatorKeyDirection
- Name: <UserType>k__BackingField
Entry: 9
Data: 11
@@ -2220,25 +2220,19 @@ MonoBehaviour:
Data:
- Name: $k
Entry: 1
Data: isSingleBitSet
Data: animatorKeyGhostType
- Name: $v
Entry: 7
Data: 111|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: isSingleBitSet
Data: animatorKeyGhostType
- Name: <UserType>k__BackingField
Entry: 7
Data: 112|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: System.Boolean[], mscorlib
- Name:
Entry: 8
Data:
Entry: 9
Data: 11
- Name: <SystemType>k__BackingField
Entry: 9
Data: 112
Data: 11
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -2253,7 +2247,7 @@ MonoBehaviour:
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 113|System.Collections.Generic.List`1[[System.Attribute, mscorlib]],
Data: 112|System.Collections.Generic.List`1[[System.Attribute, mscorlib]],
mscorlib
- Name:
Entry: 12
@@ -2275,19 +2269,25 @@ MonoBehaviour:
Data:
- Name: $k
Entry: 1
Data: cardinalDirections
Data: isSingleBitSet
- Name: $v
Entry: 7
Data: 114|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
Data: 113|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: cardinalDirections
Data: isSingleBitSet
- Name: <UserType>k__BackingField
Entry: 9
Data: 100
Entry: 7
Data: 114|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: System.Boolean[], mscorlib
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 9
Data: 101
Data: 114
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -2319,6 +2319,55 @@ MonoBehaviour:
- Name:
Entry: 8
Data:
- Name:
Entry: 7
Data:
- Name: $k
Entry: 1
Data: cardinalDirections
- Name: $v
Entry: 7
Data: 116|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: cardinalDirections
- Name: <UserType>k__BackingField
Entry: 9
Data: 102
- Name: <SystemType>k__BackingField
Entry: 9
Data: 103
- 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: 117|System.Collections.Generic.List`1[[System.Attribute, mscorlib]],
mscorlib
- Name:
Entry: 12
Data: 0
- Name:
Entry: 13
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 13
Data:

View File

@@ -15,6 +15,15 @@ namespace Marro.PacManUdon
Special,
}
enum PacManGhostAnimatorState
{
Normal,
Caught,
Scared,
ScaredWhite,
Special
}
public enum PacManGhostState
{
Normal,
@@ -68,6 +77,7 @@ namespace Marro.PacManUdon
// State
private PacManGhostState ghostState;
private bool isScared;
private bool whiteScared;
private bool scattering;
private PacManGhostFrozenState frozenState;
@@ -540,21 +550,20 @@ namespace Marro.PacManUdon
SetAnimatorDirection((int)targetDirection);
}
if (isScared) // Don't update ghost type while scared as this interrupts the white/blue blinking
{
return;
}
PacManGhostType ghostType = this.ghostType;
if (specialLook)
if (isScared)
{
ghostType = PacManGhostType.Special;
ghostType = whiteScared ? PacManGhostType.ScaredWhite : PacManGhostType.Scared;
}
else if (ghostState == PacManGhostState.Returning || ghostState == PacManGhostState.Entering)
{
ghostType = PacManGhostType.Caught;
}
else if (specialLook)
{
ghostType = PacManGhostType.Special;
}
SetAnimatorGhostType((int)ghostType);
}
@@ -671,13 +680,8 @@ namespace Marro.PacManUdon
private void SetScared(bool scared)
{
isScared = scared;
UpdateAnimator();
SetWhite(false);
UpdateSpeed();
if (isScared)
{
SetWhite(false);
}
}
public void SetScattering(bool scattering, bool reverseDirection = true)
@@ -738,10 +742,8 @@ namespace Marro.PacManUdon
public void SetWhite(bool white)
{
if (!isScared || !gameObject.activeInHierarchy)
return;
SetAnimatorGhostType(white ? (int)PacManGhostType.ScaredWhite : (int)PacManGhostType.Scared);
whiteScared = white;
UpdateAnimator();
}
public void SetElroy(int elroyLevel)
@@ -820,8 +822,8 @@ namespace Marro.PacManUdon
data.AppendAsByte((int)ghostState, ref index);
data.Append(isScared, ref index);
data.Append(whiteScared, ref index);
data.Append(scattering, ref index);
data.AppendAsByte((int)frozenState, ref index);
data.Append(offGrid, ref index);
data.AppendAsByte(housePelletCounter, ref index);
@@ -829,6 +831,8 @@ namespace Marro.PacManUdon
data.AppendAsByte(housePelletCounterLimit, ref index);
base.CollectSyncedData(data, ref index, eventType);
data.AppendAsByte((int)frozenState, ref index);
}
public override bool WriteSyncedData(byte[] data, ref int index, NetworkEventType eventType)
@@ -847,15 +851,23 @@ namespace Marro.PacManUdon
ghostState = (PacManGhostState)data.ReadByte(ref index);
isScared = data.ReadBool(ref index);
whiteScared = data.ReadBool(ref index);
scattering = data.ReadBool(ref index);
frozenState = (PacManGhostFrozenState)data.ReadByte(ref index);
offGrid = data.ReadBool(ref index);
housePelletCounter = data.ReadByte(ref index);
housePelletCounterActive = data.ReadBool(ref index);
housePelletCounterLimit = data.ReadByte(ref index);
return base.WriteSyncedData(data, ref index, eventType);
UpdateSpeed();
frozenState = PacManGhostFrozenState.NotFrozen; // Ensure UpdateAnimator runs fully
var success = base.WriteSyncedData(data, ref index, eventType);
frozenState = (PacManGhostFrozenState)data.ReadByte(ref index);
return success;
}
}
}

View File

@@ -43,7 +43,7 @@ MonoBehaviour:
Data:
- Name:
Entry: 12
Data: 39
Data: 41
- Name:
Entry: 7
Data:
@@ -1009,13 +1009,13 @@ MonoBehaviour:
Data:
- Name: $k
Entry: 1
Data: eventsToSend
Data: eventsToSendEarly
- Name: $v
Entry: 7
Data: 54|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: eventsToSend
Data: eventsToSendEarly
- Name: <UserType>k__BackingField
Entry: 7
Data: 55|System.RuntimeType, mscorlib
@@ -1063,13 +1063,13 @@ MonoBehaviour:
Data:
- Name: $k
Entry: 1
Data: eventsToSendIndex
Data: eventsToSendEarlyIndex
- Name: $v
Entry: 7
Data: 57|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: eventsToSendIndex
Data: eventsToSendEarlyIndex
- Name: <UserType>k__BackingField
Entry: 9
Data: 11
@@ -1111,16 +1111,112 @@ MonoBehaviour:
Data:
- Name: $k
Entry: 1
Data: eventsQueue
Data: eventsToSendLate
- Name: $v
Entry: 7
Data: 59|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: eventsToSendLate
- Name: <UserType>k__BackingField
Entry: 9
Data: 55
- Name: <SystemType>k__BackingField
Entry: 9
Data: 32
- 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: 60|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: eventsToSendLateIndex
- Name: $v
Entry: 7
Data: 61|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: eventsToSendLateIndex
- Name: <UserType>k__BackingField
Entry: 9
Data: 11
- Name: <SystemType>k__BackingField
Entry: 9
Data: 11
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
- Name:
Entry: 6
Data:
- Name:
Entry: 8
Data:
- Name: <IsSerialized>k__BackingField
Entry: 5
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 62|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: eventsQueue
- Name: $v
Entry: 7
Data: 63|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: eventsQueue
- Name: <UserType>k__BackingField
Entry: 7
Data: 60|System.RuntimeType, mscorlib
Data: 64|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: System.Byte[][], mscorlib
@@ -1142,102 +1238,6 @@ MonoBehaviour:
- Name: <IsSerialized>k__BackingField
Entry: 5
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 61|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: eventsQueueIndex
- Name: $v
Entry: 7
Data: 62|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: eventsQueueIndex
- Name: <UserType>k__BackingField
Entry: 9
Data: 11
- Name: <SystemType>k__BackingField
Entry: 9
Data: 11
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
- Name:
Entry: 6
Data:
- Name:
Entry: 8
Data:
- Name: <IsSerialized>k__BackingField
Entry: 5
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 63|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: eventsQueueIndexAtLastTransmission
- Name: $v
Entry: 7
Data: 64|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: eventsQueueIndexAtLastTransmission
- Name: <UserType>k__BackingField
Entry: 9
Data: 11
- Name: <SystemType>k__BackingField
Entry: 9
Data: 11
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
- Name:
Entry: 6
Data:
- Name:
Entry: 8
Data:
- Name: <IsSerialized>k__BackingField
Entry: 5
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 65|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
@@ -1261,19 +1261,19 @@ MonoBehaviour:
Data:
- Name: $k
Entry: 1
Data: eventTransmissionHistory
Data: eventsQueueIndex
- Name: $v
Entry: 7
Data: 66|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: eventTransmissionHistory
Data: eventsQueueIndex
- Name: <UserType>k__BackingField
Entry: 9
Data: 32
Data: 11
- Name: <SystemType>k__BackingField
Entry: 9
Data: 32
Data: 11
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -1309,13 +1309,13 @@ MonoBehaviour:
Data:
- Name: $k
Entry: 1
Data: eventTransmissionHistoryIndex
Data: eventsQueueIndexAtLastTransmission
- Name: $v
Entry: 7
Data: 68|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: eventTransmissionHistoryIndex
Data: eventsQueueIndexAtLastTransmission
- Name: <UserType>k__BackingField
Entry: 9
Data: 11
@@ -1357,19 +1357,19 @@ MonoBehaviour:
Data:
- Name: $k
Entry: 1
Data: lastEventTransmissionTime
Data: eventTransmissionHistory
- Name: $v
Entry: 7
Data: 70|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: lastEventTransmissionTime
Data: eventTransmissionHistory
- Name: <UserType>k__BackingField
Entry: 9
Data: 11
Data: 32
- Name: <SystemType>k__BackingField
Entry: 9
Data: 11
Data: 32
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -1405,25 +1405,19 @@ MonoBehaviour:
Data:
- Name: $k
Entry: 1
Data: lastEventId
Data: eventTransmissionHistoryIndex
- Name: $v
Entry: 7
Data: 72|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: lastEventId
Data: eventTransmissionHistoryIndex
- Name: <UserType>k__BackingField
Entry: 7
Data: 73|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: System.Byte, mscorlib
- Name:
Entry: 8
Data:
Entry: 9
Data: 11
- Name: <SystemType>k__BackingField
Entry: 9
Data: 73
Data: 11
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -1438,7 +1432,109 @@ MonoBehaviour:
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 74|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
Data: 73|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: lastEventTransmissionTime
- Name: $v
Entry: 7
Data: 74|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: lastEventTransmissionTime
- Name: <UserType>k__BackingField
Entry: 9
Data: 11
- Name: <SystemType>k__BackingField
Entry: 9
Data: 11
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
- Name:
Entry: 6
Data:
- Name:
Entry: 8
Data:
- Name: <IsSerialized>k__BackingField
Entry: 5
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 75|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: lastEventId
- Name: $v
Entry: 7
Data: 76|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: lastEventId
- Name: <UserType>k__BackingField
Entry: 7
Data: 77|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: System.Byte, mscorlib
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 9
Data: 77
- 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: 78|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 0
@@ -1462,13 +1558,13 @@ MonoBehaviour:
Data: networkedData
- Name: $v
Entry: 7
Data: 75|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
Data: 79|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: networkedData
- Name: <UserType>k__BackingField
Entry: 7
Data: 76|System.RuntimeType, mscorlib
Data: 80|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: System.Byte[], mscorlib
@@ -1477,7 +1573,7 @@ MonoBehaviour:
Data:
- Name: <SystemType>k__BackingField
Entry: 9
Data: 76
Data: 80
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -1492,13 +1588,13 @@ MonoBehaviour:
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 77|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
Data: 81|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 1
- Name:
Entry: 7
Data: 78|UdonSharp.UdonSyncedAttribute, UdonSharp.Runtime
Data: 82|UdonSharp.UdonSyncedAttribute, UdonSharp.Runtime
- Name:
Entry: 8
Data:
@@ -1520,114 +1616,18 @@ MonoBehaviour:
- Name: $k
Entry: 1
Data: ready
- Name: $v
Entry: 7
Data: 79|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: ready
- Name: <UserType>k__BackingField
Entry: 9
Data: 25
- Name: <SystemType>k__BackingField
Entry: 9
Data: 25
- 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: 80|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: synced
- Name: $v
Entry: 7
Data: 81|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: synced
- Name: <UserType>k__BackingField
Entry: 9
Data: 25
- Name: <SystemType>k__BackingField
Entry: 9
Data: 25
- 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: 82|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: <SyncedTimeTicks>k__BackingField
- Name: $v
Entry: 7
Data: 83|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: <SyncedTimeTicks>k__BackingField
Data: ready
- Name: <UserType>k__BackingField
Entry: 9
Data: 11
Data: 25
- Name: <SystemType>k__BackingField
Entry: 9
Data: 11
Data: 25
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -1663,19 +1663,19 @@ MonoBehaviour:
Data:
- Name: $k
Entry: 1
Data: <SyncedTime>k__BackingField
Data: synced
- Name: $v
Entry: 7
Data: 85|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: <SyncedTime>k__BackingField
Data: synced
- Name: <UserType>k__BackingField
Entry: 9
Data: 21
Data: 25
- Name: <SystemType>k__BackingField
Entry: 9
Data: 21
Data: 25
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -1711,19 +1711,19 @@ MonoBehaviour:
Data:
- Name: $k
Entry: 1
Data: <IsEventUpdate>k__BackingField
Data: <SyncedTimeTicks>k__BackingField
- Name: $v
Entry: 7
Data: 87|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: <IsEventUpdate>k__BackingField
Data: <SyncedTimeTicks>k__BackingField
- Name: <UserType>k__BackingField
Entry: 9
Data: 25
Data: 11
- Name: <SystemType>k__BackingField
Entry: 9
Data: 25
Data: 11
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -1759,19 +1759,19 @@ MonoBehaviour:
Data:
- Name: $k
Entry: 1
Data: isOwner
Data: <SyncedTime>k__BackingField
- Name: $v
Entry: 7
Data: 89|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: isOwner
Data: <SyncedTime>k__BackingField
- Name: <UserType>k__BackingField
Entry: 9
Data: 25
Data: 21
- Name: <SystemType>k__BackingField
Entry: 9
Data: 25
Data: 21
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -1807,25 +1807,19 @@ MonoBehaviour:
Data:
- Name: $k
Entry: 1
Data: debugOutput
Data: <IsEventUpdate>k__BackingField
- Name: $v
Entry: 7
Data: 91|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: debugOutput
Data: <IsEventUpdate>k__BackingField
- Name: <UserType>k__BackingField
Entry: 7
Data: 92|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: TMPro.TMP_InputField, Unity.TextMeshPro
- Name:
Entry: 8
Data:
Entry: 9
Data: 25
- Name: <SystemType>k__BackingField
Entry: 9
Data: 92
Data: 25
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -1837,19 +1831,13 @@ MonoBehaviour:
Data:
- Name: <IsSerialized>k__BackingField
Entry: 5
Data: true
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 93|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
Data: 92|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 1
- Name:
Entry: 7
Data: 94|UnityEngine.SerializeField, UnityEngine.CoreModule
- Name:
Entry: 8
Data:
Data: 0
- Name:
Entry: 13
Data:
@@ -1867,19 +1855,67 @@ MonoBehaviour:
Data:
- Name: $k
Entry: 1
Data: DebugImageToIndicateOwner
Data: isOwner
- Name: $v
Entry: 7
Data: 93|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: isOwner
- Name: <UserType>k__BackingField
Entry: 9
Data: 25
- Name: <SystemType>k__BackingField
Entry: 9
Data: 25
- 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: 94|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: debugOutput
- Name: $v
Entry: 7
Data: 95|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: DebugImageToIndicateOwner
Data: debugOutput
- Name: <UserType>k__BackingField
Entry: 7
Data: 96|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: UnityEngine.Animator, UnityEngine.AnimationModule
Data: TMPro.TMP_InputField, Unity.TextMeshPro
- Name:
Entry: 8
Data:
@@ -1927,19 +1963,80 @@ MonoBehaviour:
Data:
- Name: $k
Entry: 1
Data: DebugImageToIndicateSynced
Data: DebugImageToIndicateOwner
- Name: $v
Entry: 7
Data: 99|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: DebugImageToIndicateOwner
- Name: <UserType>k__BackingField
Entry: 7
Data: 100|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: UnityEngine.Animator, UnityEngine.AnimationModule
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 9
Data: 100
- 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: 101|System.Collections.Generic.List`1[[System.Attribute, mscorlib]],
mscorlib
- Name:
Entry: 12
Data: 1
- Name:
Entry: 7
Data: 102|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: DebugImageToIndicateSynced
- Name: $v
Entry: 7
Data: 103|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: DebugImageToIndicateSynced
- Name: <UserType>k__BackingField
Entry: 9
Data: 96
Data: 100
- Name: <SystemType>k__BackingField
Entry: 9
Data: 96
Data: 100
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -1954,14 +2051,14 @@ MonoBehaviour:
Data: true
- Name: _fieldAttributes
Entry: 7
Data: 100|System.Collections.Generic.List`1[[System.Attribute, mscorlib]],
Data: 104|System.Collections.Generic.List`1[[System.Attribute, mscorlib]],
mscorlib
- Name:
Entry: 12
Data: 1
- Name:
Entry: 7
Data: 101|UnityEngine.SerializeField, UnityEngine.CoreModule
Data: 105|UnityEngine.SerializeField, UnityEngine.CoreModule
- Name:
Entry: 8
Data:
@@ -1985,16 +2082,16 @@ MonoBehaviour:
Data: DebugImageToIndicateReady
- Name: $v
Entry: 7
Data: 102|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
Data: 106|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: DebugImageToIndicateReady
- Name: <UserType>k__BackingField
Entry: 9
Data: 96
Data: 100
- Name: <SystemType>k__BackingField
Entry: 9
Data: 96
Data: 100
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -2009,14 +2106,14 @@ MonoBehaviour:
Data: true
- Name: _fieldAttributes
Entry: 7
Data: 103|System.Collections.Generic.List`1[[System.Attribute, mscorlib]],
Data: 107|System.Collections.Generic.List`1[[System.Attribute, mscorlib]],
mscorlib
- Name:
Entry: 12
Data: 1
- Name:
Entry: 7
Data: 104|UnityEngine.SerializeField, UnityEngine.CoreModule
Data: 108|UnityEngine.SerializeField, UnityEngine.CoreModule
- Name:
Entry: 8
Data:
@@ -2040,13 +2137,13 @@ MonoBehaviour:
Data: tester
- Name: $v
Entry: 7
Data: 105|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
Data: 109|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: tester
- Name: <UserType>k__BackingField
Entry: 7
Data: 106|System.RuntimeType, mscorlib
Data: 110|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: NetworkManagerTester, Assembly-CSharp
@@ -2070,7 +2167,7 @@ MonoBehaviour:
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 107|System.Collections.Generic.List`1[[System.Attribute, mscorlib]],
Data: 111|System.Collections.Generic.List`1[[System.Attribute, mscorlib]],
mscorlib
- Name:
Entry: 12

View File

@@ -15,7 +15,7 @@ namespace Marro.PacManUdon
{
FullSyncForced = 0,
FullSync = 1,
PacManTurn = 2,
InputChange = 2,
StartGameButtonPressed = 3,
Pause = 7,
Resume = 8,
@@ -65,7 +65,7 @@ namespace Marro.PacManUdon
/// <summary>
/// The time delta at which updates occur.
/// </summary>
[SerializeField] private float tickDelta = 0.0166666667f;
[SerializeField] private float tickDelta = 0.0165f;
#endregion
#region Constants
@@ -162,13 +162,21 @@ namespace Marro.PacManUdon
private bool serializationRequested;
/// <summary>
/// Events to send at the end of SyncedUpdate cycle
/// Events to send at the end of SyncedUpdate cycle.
/// </summary>
private NetworkEventType[] eventsToSend;
private NetworkEventType[] eventsToSendEarly;
/// <summary>
/// Index for <see cref="eventsToSend"/>
/// Index for <see cref="eventsToSendEarly"/>.
/// </summary>
private int eventsToSendIndex;
private int eventsToSendEarlyIndex;
/// <summary>
/// Events to send at the end of SyncedUpdate cycle, delayed by a tick.
/// </summary>
private NetworkEventType[] eventsToSendLate;
/// <summary>
/// Index for <see cref="eventsToSendLate"/>.
/// </summary>
private int eventsToSendLateIndex;
/// <summary>
/// Queue of events to be transmitted or processed.
@@ -406,7 +414,7 @@ namespace Marro.PacManUdon
ProcessEventsToSend(); // Prepare events from last cycle
ProgressPingTime(); // See if we need to send a ping
}
else
if (!isOwner)
{
ApplyReceivedEvents(); // See if there's events after last update that need to be replayed
}
@@ -489,7 +497,7 @@ namespace Marro.PacManUdon
#endregion
#region Sender
public void SendEventSoon(NetworkEventType eventType)
public void SendEventSoon(NetworkEventType eventType, bool early = false)
{
if (!Ready)
{
@@ -502,27 +510,48 @@ namespace Marro.PacManUdon
return;
}
if (eventsQueueIndex > eventsToSend.Length)
if (early)
{
Debug.LogWarning($"({nameof(PacManUdon)} {nameof(NetworkManager)}) {nameof(eventsToSend)} overflow!");
HandleError(false);
return;
}
if (eventsToSendEarlyIndex >= eventsToSendEarly.Length)
{
Debug.LogWarning($"({nameof(PacManUdon)} {nameof(NetworkManager)}) {nameof(eventsToSendEarly)} overflow!");
HandleError(false);
return;
}
eventsToSend[eventsToSendIndex++] = eventType;
eventsToSendEarly[eventsToSendEarlyIndex++] = eventType;
}
else
{
if (eventsToSendLateIndex >= eventsToSendLate.Length)
{
Debug.LogWarning($"({nameof(PacManUdon)} {nameof(NetworkManager)}) {nameof(eventsToSendLate)} overflow!");
HandleError(false);
return;
}
eventsToSendLate[eventsToSendLateIndex++] = eventType;
}
}
private void ProcessEventsToSend()
{
for (int i = 0; i < eventsToSendIndex; i++)
for (int i = 0; i < eventsToSendEarlyIndex; i++)
{
SendEventNow(eventsToSend[0]);
SendEventNow(eventsToSendEarly[i], true);
}
eventsToSendIndex = 0;
eventsToSendEarlyIndex = 0;
for (int i = 0; i < eventsToSendLateIndex; i++)
{
SendEventNow(eventsToSendLate[i], false);
}
eventsToSendLateIndex = 0;
}
public void SendEventNow(NetworkEventType eventType)
public void SendEventNow(NetworkEventType eventType, bool early)
{
if (!Ready)
{
@@ -537,6 +566,11 @@ namespace Marro.PacManUdon
var timestamp = SyncedTimeTicks;
if (early)
{
timestamp--;
}
var eventId = GetNextEventId(lastEventId);
InitializeEvent(eventType, timestamp, eventId, out byte[] data, out var index);
@@ -850,11 +884,6 @@ namespace Marro.PacManUdon
if (subscribers != null)
{
foreach (var obj in subscribers)
{
obj.SyncedUpdate();
}
foreach (var obj in subscribers)
{
var success = obj.WriteSyncedData(@event, ref index, eventType);
@@ -911,8 +940,11 @@ namespace Marro.PacManUdon
eventTransmissionHistory = new int[maxEventSendTries];
eventTransmissionHistoryIndex = 0;
eventsQueueIndexAtLastTransmission = 0;
eventsToSend = new NetworkEventType[BufferMaxTotalEvents];
eventsToSendIndex = 0;
eventsToSendEarly = new NetworkEventType[BufferMaxTotalEvents];
eventsToSendEarlyIndex = 0;
eventsToSendLate = new NetworkEventType[BufferMaxTotalEvents];
eventsToSendLateIndex = 0;
}
private void DequeueEventsFromBuffer(int eventCount)

View File

@@ -1,5 +1,4 @@
using System;
using UnityEngine;
using UnityEngine;
namespace Marro.PacManUdon
{
@@ -82,27 +81,7 @@ namespace Marro.PacManUdon
return;
}
float speed = this.speed;
if (freezeSeconds > 0)
{
float freezePart = freezeSeconds / networkManager.SyncedDeltaTime;
if (freezePart >= 1)
{
freezeSeconds -= networkManager.SyncedDeltaTime;
animator.speed = 0;
speed = 0;
}
else
{
speed *= 1 - freezePart;
animator.speed = 1 - freezePart;
freezeSeconds = 0;
}
}
else
{
animator.speed = 1;
}
float speed = GetNextSpeed();
Vector2 position = GetPosition();
Vector2 nextPosition = GetNextPosition(position, directionVectors[(int)direction], speed, networkManager.SyncedDeltaTime); // The position pacman will move to, assuming it doens't get changed
@@ -127,6 +106,33 @@ namespace Marro.PacManUdon
SetPosition(nextPosition);
}
private float GetNextSpeed()
{
float speed = this.speed;
if (freezeSeconds > 0)
{
float freezePart = freezeSeconds / networkManager.SyncedDeltaTime;
if (freezePart >= 1)
{
freezeSeconds -= networkManager.SyncedDeltaTime;
animator.speed = 0;
speed = 0;
}
else
{
speed *= 1 - freezePart;
animator.speed = 1 - freezePart;
freezeSeconds = 0;
}
}
else
{
animator.speed = 1;
}
return speed;
}
private Vector2 ProcessNextPosition(Vector2 position, Vector2 nextPosition)
{
if (CrossesTileCenter(position, nextPosition, Direction.Left) // If pacman is moving horizontally, check if he may cross the center of a tile in that axis
@@ -210,11 +216,11 @@ namespace Marro.PacManUdon
if (eatResult == EatResult.Pellet)
{
freezeSeconds = 0.0166666666666667f;
freezeSeconds = 0.0165f;
}
else if (eatResult == EatResult.PowerPellet)
{
freezeSeconds = 0.05f;
freezeSeconds = 0.0495f;
}
}
@@ -239,13 +245,6 @@ namespace Marro.PacManUdon
return;
}
animator.speed = frozen ? 0 : 1;
if (frozen)
{
return;
}
if (direction.Equals(Direction.Zero))
{
SetAnimatorState((int)PacManAnimatorState.Stopped);
@@ -253,8 +252,12 @@ namespace Marro.PacManUdon
else
{
SetAnimatorState((int)PacManAnimatorState.Moving);
SetAnimatorDirection((int)targetDirection);
}
animator.speed = frozen ? 0 : 1;
SetAnimatorDirection((int)targetDirection);
}
private void SetAnimatorDirection(int value) =>
@@ -286,6 +289,7 @@ namespace Marro.PacManUdon
// Debug.Log($"{gameObject} SetLevel {level}");
defaultSpeed = PacManConstants.GetPacManDefaultSpeedForLevel(level);
powerPelletSpeed = PacManConstants.GetPacManPowerPelletSpeedForLevel(level);
UpdateSpeed();
}
public void SetPowerPellet(bool powerPellet)
@@ -353,6 +357,7 @@ namespace Marro.PacManUdon
state = (PacManState)data.ReadByte(ref index);
freezeSeconds = data.ReadFloat(ref index);
frozen = data.ReadBool(ref index);
UpdateSpeed();
return base.WriteSyncedData(data, ref index, eventType);

View File

@@ -43,7 +43,7 @@ MonoBehaviour:
Data:
- Name:
Entry: 12
Data: 11
Data: 10
- Name:
Entry: 7
Data:
@@ -385,19 +385,25 @@ MonoBehaviour:
Data:
- Name: $k
Entry: 1
Data: inputHorizontal
Data: analogInput
- Name: $v
Entry: 7
Data: 22|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: inputHorizontal
Data: analogInput
- Name: <UserType>k__BackingField
Entry: 9
Data: 20
Entry: 7
Data: 23|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: UnityEngine.Vector2, UnityEngine.CoreModule
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 9
Data: 17
Data: 23
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -412,7 +418,7 @@ MonoBehaviour:
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 23|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
Data: 24|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 0
@@ -433,19 +439,19 @@ MonoBehaviour:
Data:
- Name: $k
Entry: 1
Data: inputVertical
Data: dirty
- Name: $v
Entry: 7
Data: 24|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
Data: 25|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: inputVertical
Data: dirty
- Name: <UserType>k__BackingField
Entry: 9
Data: 20
Data: 7
- Name: <SystemType>k__BackingField
Entry: 9
Data: 17
Data: 7
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -460,7 +466,7 @@ MonoBehaviour:
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 25|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
Data: 26|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 0
@@ -481,25 +487,25 @@ MonoBehaviour:
Data:
- Name: $k
Entry: 1
Data: horizontalValue
Data: lastUsedHand
- Name: $v
Entry: 7
Data: 26|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
Data: 27|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: horizontalValue
Data: lastUsedHand
- Name: <UserType>k__BackingField
Entry: 7
Data: 27|System.RuntimeType, mscorlib
Data: 28|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: System.Single, mscorlib
Data: VRC.Udon.Common.HandType, VRC.Udon.Common
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 9
Data: 27
Data: 28
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -514,55 +520,7 @@ MonoBehaviour:
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 28|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 0
- Name:
Entry: 13
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 7
Data:
- Name: $k
Entry: 1
Data: verticalValue
- Name: $v
Entry: 7
Data: 29|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: verticalValue
- Name: <UserType>k__BackingField
Entry: 9
Data: 27
- Name: <SystemType>k__BackingField
Entry: 9
Data: 27
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
- Name:
Entry: 6
Data:
- Name:
Entry: 8
Data:
- Name: <IsSerialized>k__BackingField
Entry: 5
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 30|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
Data: 29|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 0
@@ -586,7 +544,7 @@ MonoBehaviour:
Data: horizontalPriority
- Name: $v
Entry: 7
Data: 31|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
Data: 30|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: horizontalPriority
@@ -610,7 +568,7 @@ MonoBehaviour:
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 32|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
Data: 31|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 0

View File

@@ -21,22 +21,60 @@
private InputMethod inputMethod;
private Direction resultInput;
private Direction inputHorizontal;
private Direction inputVertical;
private float horizontalValue;
private float verticalValue;
private Vector2 analogInput;
private bool dirty;
private HandType lastUsedHand;
private bool horizontalPriority;
public void Initialize(GameManager gameManager)
{
this.gameManager = gameManager;
resultInput = Direction.Zero;
inputHorizontal = Direction.Zero;
inputVertical = Direction.Zero;
horizontalPriority = false;
player = Networking.LocalPlayer;
SubscribeToEvent(NetworkEventType.PacManTurn);
player = Networking.LocalPlayer;
inputMethod = InputMethod.KeyboardMouse;
resultInput = Direction.Zero;
analogInput = Vector2.zero;
dirty = false;
horizontalPriority = false;
SubscribeToEvent(NetworkEventType.InputChange);
}
void Update()
{
if (active)
{
if (Input.GetKeyDown(KeyCode.R))
{
gameManager.ResetButtonPressed();
}
if (Input.GetKeyDown(KeyCode.G))
{
gameManager.networkManager.DoFullSync();
}
if (Input.GetKeyDown(KeyCode.C))
{
gameManager.JumpToTimeSequenceBoardClear();
}
}
else
{
if (Input.GetKeyDown(KeyCode.T))
{
gameManager.ResetButtonPressed();
}
}
}
public override void SyncedUpdate()
{
if (dirty) // Update now to ensure input feedback is performed timely
{
UpdateResultInput();
}
}
public void Activate()
@@ -81,36 +119,9 @@
return;
}
var previousInputHorizontal = inputHorizontal;
horizontalValue = Math.Abs(value);
if (value < -0.5)
{
inputHorizontal = Direction.Left;
if (horizontalValue >= verticalValue)
{
SetPriority(true);
}
}
else if (value > 0.5)
{
inputHorizontal = Direction.Right;
if (horizontalValue >= verticalValue)
{
SetPriority(true);
}
}
else
{
inputHorizontal = Direction.Zero;
SetPriority(false);
}
if (previousInputHorizontal != inputHorizontal)
{
UpdateResultInput();
}
// Debug.Log("Horizontal Input Event: " + value + " | Direction: " + direction + " | lastDirection: " + lastDirection + " | Left: " + left + " | Right: " + right);
analogInput.x = value;
lastUsedHand = args.handType;
dirty = true;
}
public override void InputMoveVertical(float value, UdonInputEventArgs args)
@@ -120,37 +131,9 @@
return;
}
var previousInputVertical = inputVertical;
verticalValue = Math.Abs(value);
if (value > 0.5)
{
inputVertical = Direction.Up;
if (verticalValue >= horizontalValue)
{
SetPriority(false);
}
}
else if (value < -0.5)
{
inputVertical = Direction.Down;
if (verticalValue >= horizontalValue)
{
SetPriority(false);
}
}
else
{
inputVertical = Direction.Zero;
SetPriority(true);
}
if (previousInputVertical != inputVertical)
{
UpdateResultInput();
}
// Debug.Log("Vertical Input Event: " + value + " | Direction: " + direction + " | lastDirection : " + lastDirection);
analogInput.y = value;
lastUsedHand = args.handType;
dirty = true;
}
public override void OnInputMethodChanged(VRCInputMethod inputMethod)
@@ -167,33 +150,108 @@
}
}
private void SetPriority(bool horizontalPriority)
{
if (this.horizontalPriority != horizontalPriority)
{
if (inputMethod != InputMethod.KeyboardMouse)
{
player.PlayHapticEventInHand(VRC_Pickup.PickupHand.Left, 0.1f, 0.15f, 75);
}
this.horizontalPriority = horizontalPriority;
}
}
private void UpdateResultInput()
{
resultInput = horizontalPriority ? inputHorizontal : inputVertical;
networkManager.SendEventSoon(NetworkEventType.PacManTurn);
dirty = false;
var newResult = GetResultInput(analogInput);
if (newResult == resultInput)
{
return;
}
//Debug.Log($"Switched to input direction {newResult} from analogInput {analogInput} with HorizontalPriority {horizontalPriority}");
resultInput = newResult;
networkManager.SendEventSoon(NetworkEventType.InputChange, true);
PlayHaptics();
}
private void PlayHaptics()
{
if (inputMethod == InputMethod.KeyboardMouse)
{
return;
}
VRC_Pickup.PickupHand hand;
switch (lastUsedHand)
{
case HandType.LEFT:
hand = VRC_Pickup.PickupHand.Left;
break;
case HandType.RIGHT:
hand = VRC_Pickup.PickupHand.Right;
break;
default:
return;
}
player.PlayHapticEventInHand(hand, 0.1f, 0.15f, 75);
}
private Direction GetResultInput(Vector2 analogInput)
{
if (analogInput.magnitude < 0.8)
{
return Direction.Zero;
}
var normalized = analogInput.normalized;
//Debug.Log($"Checking analogInput {analogInput} with HorizontalPriority {horizontalPriority}, normalized {normalized}");
const float directionDivider = 0.72f;
if (normalized.x > directionDivider)
{
horizontalPriority = false;
return Direction.Right;
}
else if (normalized.x < -directionDivider)
{
horizontalPriority = false;
return Direction.Left;
}
else if (normalized.y > directionDivider)
{
horizontalPriority = true;
return Direction.Up;
}
else if (normalized.y < -directionDivider)
{
horizontalPriority = true;
return Direction.Down;
}
if (horizontalPriority)
{
if (normalized.x > 0)
{
return Direction.Right;
}
return Direction.Left;
}
if (normalized.y > 0)
{
return Direction.Up;
}
return Direction.Down;
}
public Direction GetDirection()
{
if (dirty) // Update now to reduce input delay
{
UpdateResultInput();
}
return resultInput;
}
public override void CollectSyncedData(byte[] data, ref int index, NetworkEventType eventType)
{
if (eventType != NetworkEventType.PacManTurn)
if (eventType != NetworkEventType.InputChange)
{
return;
}
@@ -203,7 +261,7 @@
public override bool WriteSyncedData(byte[] data, ref int index, NetworkEventType eventType)
{
if (eventType != NetworkEventType.PacManTurn)
if (eventType != NetworkEventType.InputChange)
{
return true;
}

View File

@@ -12,6 +12,7 @@ namespace Marro.PacManUdon
// Reset, show maze and score display
SetMazeVisible(true);
statusDisplay.SetScoreDisplayVisible(true);
statusDisplay.SetLabel1UPTextBlinking(true);
break;
case 1:
// Increment level, show ready, show pellets, show lives indicators

View File

@@ -43,7 +43,6 @@ namespace Marro.PacManUdon
jumpingToTimeSequence = true;
TimeSequenceProgressToTime(100000f);
if (waitingForTimeSequenceFinalize)
{
TimeSequenceExecuteFinalize(currentTimeSequence);
@@ -102,22 +101,23 @@ namespace Marro.PacManUdon
}
}
private void TimeSequenceSyncWithRemote(PacManTimeSequence currentTimeSequence, float timeSequenceSecondsPassed)
private void TimeSequenceSyncWithRemote(PacManTimeSequence remoteCurrentTimeSequence, float timeSequenceSecondsPassedRemote)
{
// If the remote is in a time sequence but we're not, or we're in a different time sequence, or if we're behind,
// jump to the remote's time sequence.
if (!currentlyInTimeSequence
|| currentTimeSequence != this.currentTimeSequence
|| timeSequenceSecondsPassed < this.timeSequenceSecondsPassed)
// If our current time sequence state is incompatible with the remote time sequence, kill it
if (currentlyInTimeSequence && remoteCurrentTimeSequence != currentTimeSequence
|| timeSequenceSecondsPassedRemote < timeSequenceSecondsPassed)
{
StartTimeSequence(currentTimeSequence);
currentlyInTimeSequence = false;
}
// If we're (now) in a time sequence, jump our progress to match the one on the remote
if (currentlyInTimeSequence)
// If we're not/no longer in a time sequence, start the remote's time sequence
if (!currentlyInTimeSequence)
{
TimeSequenceProgressToTime(timeSequenceSecondsPassed);
StartTimeSequence(remoteCurrentTimeSequence);
}
// Jump our progress to match the one on the remote
TimeSequenceProgressToTime(timeSequenceSecondsPassedRemote);
}
#region Events

View File

@@ -1147,19 +1147,25 @@ MonoBehaviour:
Data:
- Name: $k
Entry: 1
Data: _nextDotSound
Data: alternatePelletSound
- Name: $v
Entry: 7
Data: 65|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: _nextDotSound
Data: alternatePelletSound
- Name: <UserType>k__BackingField
Entry: 9
Data: 17
Entry: 7
Data: 66|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: System.Boolean, mscorlib
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 9
Data: 17
Data: 66
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -1174,7 +1180,7 @@ MonoBehaviour:
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 66|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
Data: 67|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 0
@@ -1195,25 +1201,19 @@ MonoBehaviour:
Data:
- Name: $k
Entry: 1
Data: _ghostRetreating
Data: ghostRetreating
- Name: $v
Entry: 7
Data: 67|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
Data: 68|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: _ghostRetreating
Data: ghostRetreating
- Name: <UserType>k__BackingField
Entry: 7
Data: 68|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: System.Boolean, mscorlib
- Name:
Entry: 8
Data:
Entry: 9
Data: 66
- Name: <SystemType>k__BackingField
Entry: 9
Data: 68
Data: 66
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -1249,19 +1249,19 @@ MonoBehaviour:
Data:
- Name: $k
Entry: 1
Data: _ghostBlue
Data: ghostBlue
- Name: $v
Entry: 7
Data: 70|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: _ghostBlue
Data: ghostBlue
- Name: <UserType>k__BackingField
Entry: 9
Data: 68
Data: 66
- Name: <SystemType>k__BackingField
Entry: 9
Data: 68
Data: 66
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -1297,13 +1297,13 @@ MonoBehaviour:
Data:
- Name: $k
Entry: 1
Data: _ghostSoundLevel
Data: ghostSoundLevel
- Name: $v
Entry: 7
Data: 72|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: _ghostSoundLevel
Data: ghostSoundLevel
- Name: <UserType>k__BackingField
Entry: 7
Data: 73|System.RuntimeType, mscorlib
@@ -1351,19 +1351,19 @@ MonoBehaviour:
Data:
- Name: $k
Entry: 1
Data: _currentlyPlayingSiren
Data: currentlyPlayingSiren
- Name: $v
Entry: 7
Data: 75|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: _currentlyPlayingSiren
Data: currentlyPlayingSiren
- Name: <UserType>k__BackingField
Entry: 9
Data: 68
Data: 66
- Name: <SystemType>k__BackingField
Entry: 9
Data: 68
Data: 66
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -1399,19 +1399,19 @@ MonoBehaviour:
Data:
- Name: $k
Entry: 1
Data: _suppress
Data: suppress
- Name: $v
Entry: 7
Data: 77|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: _suppress
Data: suppress
- Name: <UserType>k__BackingField
Entry: 9
Data: 68
Data: 66
- Name: <SystemType>k__BackingField
Entry: 9
Data: 68
Data: 66
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib

View File

@@ -1,4 +1,5 @@
using JetBrains.Annotations;
using Marro.PacManUdon;
using UnityEngine;
@@ -27,13 +28,13 @@ public class SoundManager : SyncedObject
[SerializeField] private AudioClip siren3;
[SerializeField] private AudioClip siren4;
private AudioClip _nextDotSound;
private bool _ghostRetreating;
private bool _ghostBlue;
private int _ghostSoundLevel;
private bool _currentlyPlayingSiren;
private bool alternatePelletSound;
private bool ghostRetreating;
private bool ghostBlue;
private int ghostSoundLevel;
private bool currentlyPlayingSiren;
private bool _suppress;
private bool suppress;
public void Initialize()
{
@@ -44,19 +45,19 @@ public class SoundManager : SyncedObject
{
StopAllSound();
_nextDotSound = pacDot2;
alternatePelletSound = false;
_ghostRetreating = false;
_ghostBlue = false;
_ghostSoundLevel = 0;
_currentlyPlayingSiren = false;
ghostRetreating = false;
ghostBlue = false;
ghostSoundLevel = 0;
currentlyPlayingSiren = false;
_suppress = true;
suppress = true;
}
public void SuppressSound(bool suppress)
{
_suppress = suppress;
this.suppress = suppress;
if (suppress)
{
@@ -76,8 +77,8 @@ public class SoundManager : SyncedObject
public void PlayPelletSound()
{
PlaySound(audioSourcePacMan, _nextDotSound);
_nextDotSound = _nextDotSound == pacDot1 ? pacDot2 : pacDot1;
PlaySound(audioSourcePacMan, alternatePelletSound ? pacDot2 : pacDot1);
alternatePelletSound = !alternatePelletSound;
}
public void PlayDeathSound()
@@ -112,13 +113,13 @@ public class SoundManager : SyncedObject
public void SetGhostBlue(bool isBlue)
{
_ghostBlue = isBlue;
ghostBlue = isBlue;
UpdateGhostSound();
}
public void SetGhostRetreat(bool isRetreating)
{
_ghostRetreating = isRetreating;
ghostRetreating = isRetreating;
UpdateGhostSound();
}
@@ -151,19 +152,19 @@ public class SoundManager : SyncedObject
// Debug.Log($"UpdatePelletCount: {pelletCount}, level: {level}");
if (_ghostSoundLevel >= level)
if (ghostSoundLevel >= level)
{
return;
}
_ghostSoundLevel = level;
ghostSoundLevel = level;
UpdateGhostSound();
}
private void PlaySound(AudioSource audioSource, AudioClip audioClip, bool loop = false)
{
// Debug.Log($"PlaySound, audioSource: {audioSource}, audioClip: {audioClip}, loop: {loop}, suppress: {_suppress}");
if (_suppress)
if (suppress)
{
return;
}
@@ -181,7 +182,7 @@ public class SoundManager : SyncedObject
private void SwitchSound(AudioSource audioSource, AudioClip audioClip, bool loop)
{
if (_suppress)
if (suppress)
{
return;
}
@@ -207,22 +208,22 @@ public class SoundManager : SyncedObject
private void UpdateGhostSound()
{
if (_ghostRetreating)
if (ghostRetreating)
{
PlaySound(audioSourceGhosts, pacGhostRetreat, true);
_currentlyPlayingSiren = false;
currentlyPlayingSiren = false;
return;
}
if (_ghostBlue)
if (ghostBlue)
{
PlaySound(audioSourceGhosts, pacGhostBlue, true);
_currentlyPlayingSiren = false;
currentlyPlayingSiren = false;
return;
}
var currentGhostLevelSound = GetSoundForGhostLevel(_ghostSoundLevel);
if (_currentlyPlayingSiren)
var currentGhostLevelSound = GetSoundForGhostLevel(ghostSoundLevel);
if (currentlyPlayingSiren)
{
SwitchSound(audioSourceGhosts, currentGhostLevelSound, true);
}
@@ -231,7 +232,7 @@ public class SoundManager : SyncedObject
PlaySound(audioSourceGhosts, currentGhostLevelSound, true);
}
_currentlyPlayingSiren = true;
currentlyPlayingSiren = true;
}
private AudioClip GetSoundForGhostLevel(int ghostLevel)
@@ -253,11 +254,23 @@ public class SoundManager : SyncedObject
public override void CollectSyncedData(byte[] data, ref int index, NetworkEventType eventType)
{
data.Append(alternatePelletSound, ref index);
data.Append(ghostRetreating, ref index);
data.Append(ghostBlue, ref index);
data.AppendAsByte(ghostSoundLevel, ref index);
data.Append(currentlyPlayingSiren, ref index);
}
public override bool WriteSyncedData(byte[] data, ref int index, NetworkEventType eventType)
{
alternatePelletSound = data.ReadBool(ref index);
ghostRetreating = data.ReadBool(ref index);
ghostBlue = data.ReadBool(ref index);
ghostSoundLevel = data.ReadByte(ref index);
currentlyPlayingSiren = data.ReadBool(ref index);
UpdateGhostSound();
return true;
}
}

View File

@@ -50,7 +50,7 @@ public class TestBallManager : UdonSharpBehaviour
testBall.UpButtonPressed();
}
networkManager.SendEventSoon(NetworkEventType.PacManTurn);
networkManager.SendEventSoon(NetworkEventType.InputChange);
}
public void SyncButtonPressed()