Maze 32x32

This commit is contained in:
2026-06-17 12:12:17 +02:00
parent a24f237bd5
commit 8684f1ecc7
12 changed files with 1747 additions and 1210 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 186 B

After

Width:  |  Height:  |  Size: 582 B

File diff suppressed because it is too large Load Diff

View File

@@ -12,8 +12,6 @@ GameObject:
- component: {fileID: 7954158839068841090} - component: {fileID: 7954158839068841090}
- component: {fileID: 4205939556154507887} - component: {fileID: 4205939556154507887}
- component: {fileID: 3684828990246450362} - component: {fileID: 3684828990246450362}
- component: {fileID: 4887324676098472752}
- component: {fileID: 620240520301056681}
- component: {fileID: 2436955608773050784} - component: {fileID: 2436955608773050784}
m_Layer: 0 m_Layer: 0
m_Name: Ghost m_Name: Ghost
@@ -60,8 +58,213 @@ MonoBehaviour:
Prefab: {fileID: 0} Prefab: {fileID: 0}
PrefabModificationsReferencedUnityObjects: [] PrefabModificationsReferencedUnityObjects: []
PrefabModifications: [] PrefabModifications: []
SerializationNodes: [] SerializationNodes:
- Name: directionVectors
Entry: 7
Data: 0|UnityEngine.Vector2[], UnityEngine.CoreModule
- Name:
Entry: 12
Data: 16
- Name:
Entry: 7
Data: UnityEngine.Vector2, UnityEngine.CoreModule
- Name:
Entry: 4
Data: 0
- Name:
Entry: 4
Data: 0
- Name:
Entry: 8
Data:
- Name:
Entry: 7
Data: UnityEngine.Vector2, UnityEngine.CoreModule
- Name:
Entry: 4
Data: 0
- Name:
Entry: 4
Data: -1
- Name:
Entry: 8
Data:
- Name:
Entry: 7
Data: UnityEngine.Vector2, UnityEngine.CoreModule
- Name:
Entry: 4
Data: 0
- Name:
Entry: 4
Data: 1
- Name:
Entry: 8
Data:
- Name:
Entry: 7
Data: UnityEngine.Vector2, UnityEngine.CoreModule
- Name:
Entry: 4
Data: 0
- Name:
Entry: 4
Data: 0
- Name:
Entry: 8
Data:
- Name:
Entry: 7
Data: UnityEngine.Vector2, UnityEngine.CoreModule
- Name:
Entry: 4
Data: -1
- Name:
Entry: 4
Data: 0
- Name:
Entry: 8
Data:
- Name:
Entry: 7
Data: UnityEngine.Vector2, UnityEngine.CoreModule
- Name:
Entry: 4
Data: -1
- Name:
Entry: 4
Data: -1
- Name:
Entry: 8
Data:
- Name:
Entry: 7
Data: UnityEngine.Vector2, UnityEngine.CoreModule
- Name:
Entry: 4
Data: -1
- Name:
Entry: 4
Data: 1
- Name:
Entry: 8
Data:
- Name:
Entry: 7
Data: UnityEngine.Vector2, UnityEngine.CoreModule
- Name:
Entry: 4
Data: -1
- Name:
Entry: 4
Data: 0
- Name:
Entry: 8
Data:
- Name:
Entry: 7
Data: UnityEngine.Vector2, UnityEngine.CoreModule
- Name:
Entry: 4
Data: 1
- Name:
Entry: 4
Data: 0
- Name:
Entry: 8
Data:
- Name:
Entry: 7
Data: UnityEngine.Vector2, UnityEngine.CoreModule
- Name:
Entry: 4
Data: 1
- Name:
Entry: 4
Data: -1
- Name:
Entry: 8
Data:
- Name:
Entry: 7
Data: UnityEngine.Vector2, UnityEngine.CoreModule
- Name:
Entry: 4
Data: 1
- Name:
Entry: 4
Data: 1
- Name:
Entry: 8
Data:
- Name:
Entry: 7
Data: UnityEngine.Vector2, UnityEngine.CoreModule
- Name:
Entry: 4
Data: 1
- Name:
Entry: 4
Data: 0
- Name:
Entry: 8
Data:
- Name:
Entry: 7
Data: UnityEngine.Vector2, UnityEngine.CoreModule
- Name:
Entry: 4
Data: 0
- Name:
Entry: 4
Data: 0
- Name:
Entry: 8
Data:
- Name:
Entry: 7
Data: UnityEngine.Vector2, UnityEngine.CoreModule
- Name:
Entry: 4
Data: 0
- Name:
Entry: 4
Data: -1
- Name:
Entry: 8
Data:
- Name:
Entry: 7
Data: UnityEngine.Vector2, UnityEngine.CoreModule
- Name:
Entry: 4
Data: 0
- Name:
Entry: 4
Data: 1
- Name:
Entry: 8
Data:
- Name:
Entry: 7
Data: UnityEngine.Vector2, UnityEngine.CoreModule
- Name:
Entry: 4
Data: 0
- Name:
Entry: 4
Data: 0
- Name:
Entry: 8
Data:
- Name:
Entry: 13
Data:
- Name:
Entry: 8
Data:
_udonSharpBackingUdonBehaviour: {fileID: 2436955608773050784} _udonSharpBackingUdonBehaviour: {fileID: 2436955608773050784}
networkManager: {fileID: 0}
ghostType: 3 ghostType: 3
startState: 0 startState: 0
--- !u!212 &4205939556154507887 --- !u!212 &4205939556154507887
@@ -137,54 +340,6 @@ Animator:
m_AllowConstantClipSamplingOptimization: 1 m_AllowConstantClipSamplingOptimization: 1
m_KeepAnimatorStateOnDisable: 0 m_KeepAnimatorStateOnDisable: 0
m_WriteDefaultValuesOnDisable: 0 m_WriteDefaultValuesOnDisable: 0
--- !u!54 &4887324676098472752
Rigidbody:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 363162966199215175}
serializedVersion: 4
m_Mass: 1
m_Drag: 0
m_AngularDrag: 0.05
m_CenterOfMass: {x: 0, y: 0, z: 0}
m_InertiaTensor: {x: 1, y: 1, z: 1}
m_InertiaRotation: {x: 0, y: 0, z: 0, w: 1}
m_IncludeLayers:
serializedVersion: 2
m_Bits: 0
m_ExcludeLayers:
serializedVersion: 2
m_Bits: 0
m_ImplicitCom: 1
m_ImplicitTensor: 1
m_UseGravity: 1
m_IsKinematic: 1
m_Interpolate: 0
m_Constraints: 0
m_CollisionDetection: 0
--- !u!65 &620240520301056681
BoxCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 363162966199215175}
m_Material: {fileID: 0}
m_IncludeLayers:
serializedVersion: 2
m_Bits: 0
m_ExcludeLayers:
serializedVersion: 2
m_Bits: 0
m_LayerOverridePriority: 0
m_IsTrigger: 0
m_ProvidesContacts: 0
m_Enabled: 1
serializedVersion: 3
m_Size: {x: 0.5, y: 0.5, z: 2}
m_Center: {x: 0, y: 0, z: 0}
--- !u!114 &2436955608773050784 --- !u!114 &2436955608773050784
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

View File

@@ -3322,6 +3322,88 @@ GameObject:
m_CorrespondingSourceObject: {fileID: 6209180315988547563, guid: 15ac0ed4c56c7784ea3ae9000fc2af1f, type: 3} m_CorrespondingSourceObject: {fileID: 6209180315988547563, guid: 15ac0ed4c56c7784ea3ae9000fc2af1f, type: 3}
m_PrefabInstance: {fileID: 7528894854307259292} m_PrefabInstance: {fileID: 7528894854307259292}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
--- !u!1 &618993320
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 618993321}
- component: {fileID: 618993323}
- component: {fileID: 618993322}
m_Layer: 0
m_Name: MazeDefinitionGenerator
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &618993321
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 618993320}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 1.8929999, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 1203813883}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &618993322
MonoBehaviour:
m_ObjectHideFlags: 2
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 618993320}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 45115577ef41a5b4ca741ed302693907, type: 3}
m_Name:
m_EditorClassIdentifier:
interactTextPlacement: {fileID: 0}
interactText: Use
interactTextGO: {fileID: 0}
proximity: 2
SynchronizePosition: 0
AllowCollisionOwnershipTransfer: 0
Reliable: 0
_syncMethod: 2
serializedProgramAsset: {fileID: 11400000, guid: ea99e044f80fed446bb669640608f521, type: 2}
programSource: {fileID: 11400000, guid: 909752e684c57f24093795e3ba5e2c80, type: 2}
serializedPublicVariablesBytesString: Ai8AAAAAATIAAABWAFIAQwAuAFUAZABvAG4ALgBDAG8AbQBtAG8AbgAuAFUAZABvAG4AVgBhAHIAaQBhAGIAbABlAFQAYQBiAGwAZQAsACAAVgBSAEMALgBVAGQAbwBuAC4AQwBvAG0AbQBvAG4AAAAAAAYBAAAAAAAAACcBBAAAAHQAeQBwAGUAAWgAAABTAHkAcwB0AGUAbQAuAEMAbwBsAGwAZQBjAHQAaQBvAG4AcwAuAEcAZQBuAGUAcgBpAGMALgBMAGkAcwB0AGAAMQBbAFsAVgBSAEMALgBVAGQAbwBuAC4AQwBvAG0AbQBvAG4ALgBJAG4AdABlAHIAZgBhAGMAZQBzAC4ASQBVAGQAbwBuAFYAYQByAGkAYQBiAGwAZQAsACAAVgBSAEMALgBVAGQAbwBuAC4AQwBvAG0AbQBvAG4AXQBdACwAIABtAHMAYwBvAHIAbABpAGIAAQEJAAAAVgBhAHIAaQBhAGIAbABlAHMALwEAAAABaAAAAFMAeQBzAHQAZQBtAC4AQwBvAGwAbABlAGMAdABpAG8AbgBzAC4ARwBlAG4AZQByAGkAYwAuAEwAaQBzAHQAYAAxAFsAWwBWAFIAQwAuAFUAZABvAG4ALgBDAG8AbQBtAG8AbgAuAEkAbgB0AGUAcgBmAGEAYwBlAHMALgBJAFUAZABvAG4AVgBhAHIAaQBhAGIAbABlACwAIABWAFIAQwAuAFUAZABvAG4ALgBDAG8AbQBtAG8AbgBdAF0ALAAgAG0AcwBjAG8AcgBsAGkAYgABAAAABgEAAAAAAAAAAi8CAAAAAUkAAABWAFIAQwAuAFUAZABvAG4ALgBDAG8AbQBtAG8AbgAuAFUAZABvAG4AVgBhAHIAaQBhAGIAbABlAGAAMQBbAFsAUwB5AHMAdABlAG0ALgBJAG4AdAAzADIALAAgAG0AcwBjAG8AcgBsAGkAYgBdAF0ALAAgAFYAUgBDAC4AVQBkAG8AbgAuAEMAbwBtAG0AbwBuAAIAAAAGAgAAAAAAAAAnAQQAAAB0AHkAcABlAAEXAAAAUwB5AHMAdABlAG0ALgBTAHQAcgBpAG4AZwAsACAAbQBzAGMAbwByAGwAaQBiACcBCgAAAFMAeQBtAGIAbwBsAE4AYQBtAGUAAR8AAABfAF8AXwBVAGQAbwBuAFMAaABhAHIAcABCAGUAaABhAHYAaQBvAHUAcgBWAGUAcgBzAGkAbwBuAF8AXwBfACcBBAAAAHQAeQBwAGUAARYAAABTAHkAcwB0AGUAbQAuAEkAbgB0ADMAMgAsACAAbQBzAGMAbwByAGwAaQBiABcBBQAAAFYAYQBsAHUAZQACAAAABwUHBQcF
publicVariablesUnityEngineObjects: []
publicVariablesSerializationDataFormat: 0
--- !u!114 &618993323
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 618993320}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 30a9bec71a4b36a41a9b6ee899bef38c, type: 3}
m_Name:
m_EditorClassIdentifier:
serializationData:
SerializedFormat: 2
SerializedBytes:
ReferencedUnityObjects: []
SerializedBytesString:
Prefab: {fileID: 0}
PrefabModificationsReferencedUnityObjects: []
PrefabModifications: []
SerializationNodes: []
_udonSharpBackingUdonBehaviour: {fileID: 618993322}
bonusFruit: {fileID: 905219926}
pelletManager: {fileID: 1777057130}
--- !u!1 &620407010 stripped --- !u!1 &620407010 stripped
GameObject: GameObject:
m_CorrespondingSourceObject: {fileID: 9086668275070771076, guid: 15ac0ed4c56c7784ea3ae9000fc2af1f, type: 3} m_CorrespondingSourceObject: {fileID: 9086668275070771076, guid: 15ac0ed4c56c7784ea3ae9000fc2af1f, type: 3}
@@ -4378,6 +4460,17 @@ GameObject:
m_CorrespondingSourceObject: {fileID: 5229491298805062834, guid: 15ac0ed4c56c7784ea3ae9000fc2af1f, type: 3} m_CorrespondingSourceObject: {fileID: 5229491298805062834, guid: 15ac0ed4c56c7784ea3ae9000fc2af1f, type: 3}
m_PrefabInstance: {fileID: 7528894854307259292} m_PrefabInstance: {fileID: 7528894854307259292}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
--- !u!114 &905219926 stripped
MonoBehaviour:
m_CorrespondingSourceObject: {fileID: 9157969083631739240, guid: 15ac0ed4c56c7784ea3ae9000fc2af1f, type: 3}
m_PrefabInstance: {fileID: 7528894854307259292}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 905219922}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 69f55731c01fe80429d32f4509fd13b5, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1 &913595181 --- !u!1 &913595181
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@@ -5800,6 +5893,11 @@ GameObject:
m_CorrespondingSourceObject: {fileID: 7543685317323407149, guid: 15ac0ed4c56c7784ea3ae9000fc2af1f, type: 3} m_CorrespondingSourceObject: {fileID: 7543685317323407149, guid: 15ac0ed4c56c7784ea3ae9000fc2af1f, type: 3}
m_PrefabInstance: {fileID: 7528894854307259292} m_PrefabInstance: {fileID: 7528894854307259292}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
--- !u!212 &1157790591 stripped
SpriteRenderer:
m_CorrespondingSourceObject: {fileID: 6717290563504616900, guid: 15ac0ed4c56c7784ea3ae9000fc2af1f, type: 3}
m_PrefabInstance: {fileID: 7528894854307259292}
m_PrefabAsset: {fileID: 0}
--- !u!1 &1161575203 --- !u!1 &1161575203
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@@ -6152,6 +6250,7 @@ Transform:
- {fileID: 1170168279} - {fileID: 1170168279}
- {fileID: 1444498886} - {fileID: 1444498886}
- {fileID: 805005471} - {fileID: 805005471}
- {fileID: 618993321}
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1205077363 stripped --- !u!1 &1205077363 stripped
@@ -7022,6 +7121,10 @@ PrefabInstance:
propertyPath: m_Name propertyPath: m_Name
value: PacManGame (1) value: PacManGame (1)
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 6505452106475299050, guid: 15ac0ed4c56c7784ea3ae9000fc2af1f, type: 3}
propertyPath: m_IsActive
value: 1
objectReference: {fileID: 0}
- target: {fileID: 6516549313887553636, guid: 15ac0ed4c56c7784ea3ae9000fc2af1f, type: 3} - target: {fileID: 6516549313887553636, guid: 15ac0ed4c56c7784ea3ae9000fc2af1f, type: 3}
propertyPath: serializationData.Prefab propertyPath: serializationData.Prefab
value: value:
@@ -7415,21 +7518,57 @@ PrefabInstance:
- targetCorrespondingSourceObject: {fileID: 3733008235006632882, guid: 15ac0ed4c56c7784ea3ae9000fc2af1f, type: 3} - targetCorrespondingSourceObject: {fileID: 3733008235006632882, guid: 15ac0ed4c56c7784ea3ae9000fc2af1f, type: 3}
insertIndex: -1 insertIndex: -1
addedObject: {fileID: 0} addedObject: {fileID: 0}
- targetCorrespondingSourceObject: {fileID: 1976549912044134044, guid: 15ac0ed4c56c7784ea3ae9000fc2af1f, type: 3}
insertIndex: -1
addedObject: {fileID: 0}
- targetCorrespondingSourceObject: {fileID: 946049230122111055, guid: 15ac0ed4c56c7784ea3ae9000fc2af1f, type: 3}
insertIndex: -1
addedObject: {fileID: 0}
- targetCorrespondingSourceObject: {fileID: 3884000982531321632, guid: 15ac0ed4c56c7784ea3ae9000fc2af1f, type: 3}
insertIndex: -1
addedObject: {fileID: 0}
- targetCorrespondingSourceObject: {fileID: 7360432264745744659, guid: 15ac0ed4c56c7784ea3ae9000fc2af1f, type: 3}
insertIndex: -1
addedObject: {fileID: 0}
- targetCorrespondingSourceObject: {fileID: 8473082740403796940, guid: 15ac0ed4c56c7784ea3ae9000fc2af1f, type: 3}
insertIndex: -1
addedObject: {fileID: 0}
- targetCorrespondingSourceObject: {fileID: 6177469951915325012, guid: 15ac0ed4c56c7784ea3ae9000fc2af1f, type: 3}
insertIndex: -1
addedObject: {fileID: 0}
- targetCorrespondingSourceObject: {fileID: 5895072277459163218, guid: 15ac0ed4c56c7784ea3ae9000fc2af1f, type: 3}
insertIndex: -1
addedObject: {fileID: 0}
- targetCorrespondingSourceObject: {fileID: 7578339981777433697, guid: 15ac0ed4c56c7784ea3ae9000fc2af1f, type: 3}
insertIndex: -1
addedObject: {fileID: 0}
- targetCorrespondingSourceObject: {fileID: 4516921380093177367, guid: 15ac0ed4c56c7784ea3ae9000fc2af1f, type: 3}
insertIndex: -1
addedObject: {fileID: 0}
- targetCorrespondingSourceObject: {fileID: 4005231931981461914, guid: 15ac0ed4c56c7784ea3ae9000fc2af1f, type: 3}
insertIndex: -1
addedObject: {fileID: 0}
- targetCorrespondingSourceObject: {fileID: 1201452541656116112, guid: 15ac0ed4c56c7784ea3ae9000fc2af1f, type: 3}
insertIndex: -1
addedObject: {fileID: 0}
- targetCorrespondingSourceObject: {fileID: 945459299333252523, guid: 15ac0ed4c56c7784ea3ae9000fc2af1f, type: 3}
insertIndex: -1
addedObject: {fileID: 0}
- targetCorrespondingSourceObject: {fileID: 4283788326543693181, guid: 15ac0ed4c56c7784ea3ae9000fc2af1f, type: 3} - targetCorrespondingSourceObject: {fileID: 4283788326543693181, guid: 15ac0ed4c56c7784ea3ae9000fc2af1f, type: 3}
insertIndex: -1 insertIndex: -1
addedObject: {fileID: 0} addedObject: {fileID: 0}
- targetCorrespondingSourceObject: {fileID: 8749833617750005817, guid: 15ac0ed4c56c7784ea3ae9000fc2af1f, type: 3} - targetCorrespondingSourceObject: {fileID: 8749833617750005817, guid: 15ac0ed4c56c7784ea3ae9000fc2af1f, type: 3}
insertIndex: -1 insertIndex: -1
addedObject: {fileID: 0} addedObject: {fileID: 0}
- targetCorrespondingSourceObject: {fileID: 7757089264771582114, guid: 15ac0ed4c56c7784ea3ae9000fc2af1f, type: 3}
insertIndex: -1
addedObject: {fileID: 0}
- targetCorrespondingSourceObject: {fileID: 5163240847006920611, guid: 15ac0ed4c56c7784ea3ae9000fc2af1f, type: 3} - targetCorrespondingSourceObject: {fileID: 5163240847006920611, guid: 15ac0ed4c56c7784ea3ae9000fc2af1f, type: 3}
insertIndex: -1 insertIndex: -1
addedObject: {fileID: 0} addedObject: {fileID: 0}
- targetCorrespondingSourceObject: {fileID: 8985312357426446245, guid: 15ac0ed4c56c7784ea3ae9000fc2af1f, type: 3} - targetCorrespondingSourceObject: {fileID: 8985312357426446245, guid: 15ac0ed4c56c7784ea3ae9000fc2af1f, type: 3}
insertIndex: -1 insertIndex: -1
addedObject: {fileID: 0} addedObject: {fileID: 0}
- targetCorrespondingSourceObject: {fileID: 7757089264771582114, guid: 15ac0ed4c56c7784ea3ae9000fc2af1f, type: 3}
insertIndex: -1
addedObject: {fileID: 0}
m_SourcePrefab: {fileID: 100100000, guid: 15ac0ed4c56c7784ea3ae9000fc2af1f, type: 3} m_SourcePrefab: {fileID: 100100000, guid: 15ac0ed4c56c7784ea3ae9000fc2af1f, type: 3}
--- !u!1 &1214273987 stripped --- !u!1 &1214273987 stripped
GameObject: GameObject:
@@ -9919,10 +10058,6 @@ MonoBehaviour:
ID: 77 ID: 77
SerializedTypeNames: SerializedTypeNames:
- VRC.Udon.UdonBehaviour - VRC.Udon.UdonBehaviour
- gameObject: {fileID: 2032335686}
ID: 78
SerializedTypeNames:
- VRC.Udon.UdonBehaviour
- gameObject: {fileID: 129595475} - gameObject: {fileID: 129595475}
ID: 79 ID: 79
SerializedTypeNames: SerializedTypeNames:
@@ -11980,11 +12115,14 @@ MonoBehaviour:
SerializedTypeNames: SerializedTypeNames:
- VRC.Udon.UdonBehaviour - VRC.Udon.UdonBehaviour
- VRC.Udon.UdonBehaviour - VRC.Udon.UdonBehaviour
- gameObject: {fileID: 618993320}
ID: 595
SerializedTypeNames:
- VRC.Udon.UdonBehaviour
- gameObject: {fileID: 1777057122} - gameObject: {fileID: 1777057122}
ID: 39 ID: 39
SerializedTypeNames: SerializedTypeNames:
- VRC.Udon.UdonBehaviour - VRC.Udon.UdonBehaviour
- VRC.Udon.UdonBehaviour
portraitCameraPositionOffset: {x: 0, y: 0, z: 0} portraitCameraPositionOffset: {x: 0, y: 0, z: 0}
portraitCameraRotationOffset: {x: 0, y: 1, z: 0, w: -0.00000004371139} portraitCameraRotationOffset: {x: 0, y: 1, z: 0, w: -0.00000004371139}
PlayerPersistence: [] PlayerPersistence: []
@@ -12134,53 +12272,17 @@ GameObject:
m_CorrespondingSourceObject: {fileID: 8569251470677094682, guid: 15ac0ed4c56c7784ea3ae9000fc2af1f, type: 3} m_CorrespondingSourceObject: {fileID: 8569251470677094682, guid: 15ac0ed4c56c7784ea3ae9000fc2af1f, type: 3}
m_PrefabInstance: {fileID: 7528894854307259292} m_PrefabInstance: {fileID: 7528894854307259292}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
--- !u!114 &1777057126 --- !u!114 &1777057130 stripped
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 2 m_CorrespondingSourceObject: {fileID: 5525660384197170489, guid: 15ac0ed4c56c7784ea3ae9000fc2af1f, type: 3}
m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 7528894854307259292}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1777057122} m_GameObject: {fileID: 1777057122}
m_Enabled: 1 m_Enabled: 1
m_EditorHideFlags: 0 m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 45115577ef41a5b4ca741ed302693907, type: 3} m_Script: {fileID: 11500000, guid: 71c8438dc95de4c44896841f1fece6b9, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
interactTextPlacement: {fileID: 0}
interactText: Use
interactTextGO: {fileID: 0}
proximity: 2
SynchronizePosition: 0
AllowCollisionOwnershipTransfer: 0
Reliable: 0
_syncMethod: 2
serializedProgramAsset: {fileID: 11400000, guid: ea99e044f80fed446bb669640608f521, type: 2}
programSource: {fileID: 11400000, guid: 909752e684c57f24093795e3ba5e2c80, type: 2}
serializedPublicVariablesBytesString: Ai8AAAAAATIAAABWAFIAQwAuAFUAZABvAG4ALgBDAG8AbQBtAG8AbgAuAFUAZABvAG4AVgBhAHIAaQBhAGIAbABlAFQAYQBiAGwAZQAsACAAVgBSAEMALgBVAGQAbwBuAC4AQwBvAG0AbQBvAG4AAAAAAAYBAAAAAAAAACcBBAAAAHQAeQBwAGUAAWgAAABTAHkAcwB0AGUAbQAuAEMAbwBsAGwAZQBjAHQAaQBvAG4AcwAuAEcAZQBuAGUAcgBpAGMALgBMAGkAcwB0AGAAMQBbAFsAVgBSAEMALgBVAGQAbwBuAC4AQwBvAG0AbQBvAG4ALgBJAG4AdABlAHIAZgBhAGMAZQBzAC4ASQBVAGQAbwBuAFYAYQByAGkAYQBiAGwAZQAsACAAVgBSAEMALgBVAGQAbwBuAC4AQwBvAG0AbQBvAG4AXQBdACwAIABtAHMAYwBvAHIAbABpAGIAAQEJAAAAVgBhAHIAaQBhAGIAbABlAHMALwEAAAABaAAAAFMAeQBzAHQAZQBtAC4AQwBvAGwAbABlAGMAdABpAG8AbgBzAC4ARwBlAG4AZQByAGkAYwAuAEwAaQBzAHQAYAAxAFsAWwBWAFIAQwAuAFUAZABvAG4ALgBDAG8AbQBtAG8AbgAuAEkAbgB0AGUAcgBmAGEAYwBlAHMALgBJAFUAZABvAG4AVgBhAHIAaQBhAGIAbABlACwAIABWAFIAQwAuAFUAZABvAG4ALgBDAG8AbQBtAG8AbgBdAF0ALAAgAG0AcwBjAG8AcgBsAGkAYgABAAAABgEAAAAAAAAAAi8CAAAAAUkAAABWAFIAQwAuAFUAZABvAG4ALgBDAG8AbQBtAG8AbgAuAFUAZABvAG4AVgBhAHIAaQBhAGIAbABlAGAAMQBbAFsAUwB5AHMAdABlAG0ALgBJAG4AdAAzADIALAAgAG0AcwBjAG8AcgBsAGkAYgBdAF0ALAAgAFYAUgBDAC4AVQBkAG8AbgAuAEMAbwBtAG0AbwBuAAIAAAAGAgAAAAAAAAAnAQQAAAB0AHkAcABlAAEXAAAAUwB5AHMAdABlAG0ALgBTAHQAcgBpAG4AZwAsACAAbQBzAGMAbwByAGwAaQBiACcBCgAAAFMAeQBtAGIAbwBsAE4AYQBtAGUAAR8AAABfAF8AXwBVAGQAbwBuAFMAaABhAHIAcABCAGUAaABhAHYAaQBvAHUAcgBWAGUAcgBzAGkAbwBuAF8AXwBfACcBBAAAAHQAeQBwAGUAARYAAABTAHkAcwB0AGUAbQAuAEkAbgB0ADMAMgAsACAAbQBzAGMAbwByAGwAaQBiABcBBQAAAFYAYQBsAHUAZQACAAAABwUHBQcF
publicVariablesUnityEngineObjects: []
publicVariablesSerializationDataFormat: 0
--- !u!114 &1777057127
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1777057122}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 30a9bec71a4b36a41a9b6ee899bef38c, type: 3}
m_Name:
m_EditorClassIdentifier:
serializationData:
SerializedFormat: 2
SerializedBytes:
ReferencedUnityObjects: []
SerializedBytesString:
Prefab: {fileID: 0}
PrefabModificationsReferencedUnityObjects: []
PrefabModifications: []
SerializationNodes: []
_udonSharpBackingUdonBehaviour: {fileID: 1777057126}
--- !u!1 &1785134014 stripped --- !u!1 &1785134014 stripped
GameObject: GameObject:
m_CorrespondingSourceObject: {fileID: 7466015648019123541, guid: 15ac0ed4c56c7784ea3ae9000fc2af1f, type: 3} m_CorrespondingSourceObject: {fileID: 7466015648019123541, guid: 15ac0ed4c56c7784ea3ae9000fc2af1f, type: 3}
@@ -13441,11 +13543,6 @@ GameObject:
m_CorrespondingSourceObject: {fileID: 2520602138929881729, guid: 15ac0ed4c56c7784ea3ae9000fc2af1f, type: 3} m_CorrespondingSourceObject: {fileID: 2520602138929881729, guid: 15ac0ed4c56c7784ea3ae9000fc2af1f, type: 3}
m_PrefabInstance: {fileID: 7528894854307259292} m_PrefabInstance: {fileID: 7528894854307259292}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
--- !u!1 &2032335686 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 4879515261813748277, guid: 15ac0ed4c56c7784ea3ae9000fc2af1f, type: 3}
m_PrefabInstance: {fileID: 7528894854307259292}
m_PrefabAsset: {fileID: 0}
--- !u!1 &2032909032 stripped --- !u!1 &2032909032 stripped
GameObject: GameObject:
m_CorrespondingSourceObject: {fileID: 1757867658848418529, guid: 15ac0ed4c56c7784ea3ae9000fc2af1f, type: 3} m_CorrespondingSourceObject: {fileID: 1757867658848418529, guid: 15ac0ed4c56c7784ea3ae9000fc2af1f, type: 3}
@@ -14294,6 +14391,10 @@ PrefabInstance:
propertyPath: serializationData.Prefab propertyPath: serializationData.Prefab
value: value:
objectReference: {fileID: 924272570997129752, guid: 15ac0ed4c56c7784ea3ae9000fc2af1f, type: 3} objectReference: {fileID: 924272570997129752, guid: 15ac0ed4c56c7784ea3ae9000fc2af1f, type: 3}
- target: {fileID: 938860582923239144, guid: 15ac0ed4c56c7784ea3ae9000fc2af1f, type: 3}
propertyPath: direction
value: 8
objectReference: {fileID: 0}
- target: {fileID: 938860582923239144, guid: 15ac0ed4c56c7784ea3ae9000fc2af1f, type: 3} - target: {fileID: 938860582923239144, guid: 15ac0ed4c56c7784ea3ae9000fc2af1f, type: 3}
propertyPath: serializationData.Prefab propertyPath: serializationData.Prefab
value: value:
@@ -14350,6 +14451,10 @@ PrefabInstance:
propertyPath: serializationData.Prefab propertyPath: serializationData.Prefab
value: value:
objectReference: {fileID: 1576847302585915034, guid: 15ac0ed4c56c7784ea3ae9000fc2af1f, type: 3} objectReference: {fileID: 1576847302585915034, guid: 15ac0ed4c56c7784ea3ae9000fc2af1f, type: 3}
- target: {fileID: 1669426961422516371, guid: 15ac0ed4c56c7784ea3ae9000fc2af1f, type: 3}
propertyPath: direction
value: 4
objectReference: {fileID: 0}
- target: {fileID: 1669426961422516371, guid: 15ac0ed4c56c7784ea3ae9000fc2af1f, type: 3} - target: {fileID: 1669426961422516371, guid: 15ac0ed4c56c7784ea3ae9000fc2af1f, type: 3}
propertyPath: serializationData.Prefab propertyPath: serializationData.Prefab
value: value:
@@ -14586,6 +14691,26 @@ PrefabInstance:
propertyPath: m_LocalPosition.x propertyPath: m_LocalPosition.x
value: 0.91 value: 0.91
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 3555002988650332767, guid: 15ac0ed4c56c7784ea3ae9000fc2af1f, type: 3}
propertyPath: m_LocalRotation.w
value: 0.70715266
objectReference: {fileID: 0}
- target: {fileID: 3555002988650332767, guid: 15ac0ed4c56c7784ea3ae9000fc2af1f, type: 3}
propertyPath: m_LocalRotation.x
value: 0.707061
objectReference: {fileID: 0}
- target: {fileID: 3555002988650332767, guid: 15ac0ed4c56c7784ea3ae9000fc2af1f, type: 3}
propertyPath: m_LocalRotation.y
value: -0
objectReference: {fileID: 0}
- target: {fileID: 3555002988650332767, guid: 15ac0ed4c56c7784ea3ae9000fc2af1f, type: 3}
propertyPath: m_LocalRotation.z
value: -0
objectReference: {fileID: 0}
- target: {fileID: 3555002988650332767, guid: 15ac0ed4c56c7784ea3ae9000fc2af1f, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 90
objectReference: {fileID: 0}
- target: {fileID: 3559251034056489513, guid: 15ac0ed4c56c7784ea3ae9000fc2af1f, type: 3} - target: {fileID: 3559251034056489513, guid: 15ac0ed4c56c7784ea3ae9000fc2af1f, type: 3}
propertyPath: serializationData.Prefab propertyPath: serializationData.Prefab
value: value:
@@ -14630,6 +14755,10 @@ PrefabInstance:
propertyPath: serializationData.Prefab propertyPath: serializationData.Prefab
value: value:
objectReference: {fileID: 4005708588235435073, guid: 15ac0ed4c56c7784ea3ae9000fc2af1f, type: 3} objectReference: {fileID: 4005708588235435073, guid: 15ac0ed4c56c7784ea3ae9000fc2af1f, type: 3}
- target: {fileID: 4040845933795309188, guid: 15ac0ed4c56c7784ea3ae9000fc2af1f, type: 3}
propertyPath: pelletRenderer
value:
objectReference: {fileID: 1157790591}
- target: {fileID: 4040845933795309188, guid: 15ac0ed4c56c7784ea3ae9000fc2af1f, type: 3} - target: {fileID: 4040845933795309188, guid: 15ac0ed4c56c7784ea3ae9000fc2af1f, type: 3}
propertyPath: serializationData.Prefab propertyPath: serializationData.Prefab
value: value:
@@ -14770,6 +14899,10 @@ PrefabInstance:
propertyPath: serializationData.Prefab propertyPath: serializationData.Prefab
value: value:
objectReference: {fileID: 5020539064116364618, guid: 15ac0ed4c56c7784ea3ae9000fc2af1f, type: 3} objectReference: {fileID: 5020539064116364618, guid: 15ac0ed4c56c7784ea3ae9000fc2af1f, type: 3}
- target: {fileID: 5021651896465857381, guid: 15ac0ed4c56c7784ea3ae9000fc2af1f, type: 3}
propertyPath: m_Enabled
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5031360617562026835, guid: 15ac0ed4c56c7784ea3ae9000fc2af1f, type: 3} - target: {fileID: 5031360617562026835, guid: 15ac0ed4c56c7784ea3ae9000fc2af1f, type: 3}
propertyPath: serializationData.Prefab propertyPath: serializationData.Prefab
value: value:
@@ -15018,6 +15151,10 @@ PrefabInstance:
propertyPath: serializationData.Prefab propertyPath: serializationData.Prefab
value: value:
objectReference: {fileID: 6781781304980909979, guid: 15ac0ed4c56c7784ea3ae9000fc2af1f, type: 3} objectReference: {fileID: 6781781304980909979, guid: 15ac0ed4c56c7784ea3ae9000fc2af1f, type: 3}
- target: {fileID: 6789564741839907965, guid: 15ac0ed4c56c7784ea3ae9000fc2af1f, type: 3}
propertyPath: m_Enabled
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6822019726439862461, guid: 15ac0ed4c56c7784ea3ae9000fc2af1f, type: 3} - target: {fileID: 6822019726439862461, guid: 15ac0ed4c56c7784ea3ae9000fc2af1f, type: 3}
propertyPath: serializationData.Prefab propertyPath: serializationData.Prefab
value: value:
@@ -15347,7 +15484,8 @@ PrefabInstance:
value: value:
objectReference: {fileID: 9191377896296995294, guid: 15ac0ed4c56c7784ea3ae9000fc2af1f, type: 3} objectReference: {fileID: 9191377896296995294, guid: 15ac0ed4c56c7784ea3ae9000fc2af1f, type: 3}
m_RemovedComponents: [] m_RemovedComponents: []
m_RemovedGameObjects: [] m_RemovedGameObjects:
- {fileID: 4879515261813748277, guid: 15ac0ed4c56c7784ea3ae9000fc2af1f, type: 3}
m_AddedGameObjects: [] m_AddedGameObjects: []
m_AddedComponents: m_AddedComponents:
- targetCorrespondingSourceObject: {fileID: 760989357904163835, guid: 15ac0ed4c56c7784ea3ae9000fc2af1f, type: 3} - targetCorrespondingSourceObject: {fileID: 760989357904163835, guid: 15ac0ed4c56c7784ea3ae9000fc2af1f, type: 3}
@@ -15368,12 +15506,6 @@ PrefabInstance:
- targetCorrespondingSourceObject: {fileID: 7219308242589081280, guid: 15ac0ed4c56c7784ea3ae9000fc2af1f, type: 3} - targetCorrespondingSourceObject: {fileID: 7219308242589081280, guid: 15ac0ed4c56c7784ea3ae9000fc2af1f, type: 3}
insertIndex: -1 insertIndex: -1
addedObject: {fileID: 0} addedObject: {fileID: 0}
- targetCorrespondingSourceObject: {fileID: 8569251470677094682, guid: 15ac0ed4c56c7784ea3ae9000fc2af1f, type: 3}
insertIndex: -1
addedObject: {fileID: 1777057127}
- targetCorrespondingSourceObject: {fileID: 8569251470677094682, guid: 15ac0ed4c56c7784ea3ae9000fc2af1f, type: 3}
insertIndex: -1
addedObject: {fileID: 1777057126}
- targetCorrespondingSourceObject: {fileID: 5818876718058315162, guid: 15ac0ed4c56c7784ea3ae9000fc2af1f, type: 3} - targetCorrespondingSourceObject: {fileID: 5818876718058315162, guid: 15ac0ed4c56c7784ea3ae9000fc2af1f, type: 3}
insertIndex: -1 insertIndex: -1
addedObject: {fileID: 0} addedObject: {fileID: 0}
@@ -15383,21 +15515,57 @@ PrefabInstance:
- targetCorrespondingSourceObject: {fileID: 3733008235006632882, guid: 15ac0ed4c56c7784ea3ae9000fc2af1f, type: 3} - targetCorrespondingSourceObject: {fileID: 3733008235006632882, guid: 15ac0ed4c56c7784ea3ae9000fc2af1f, type: 3}
insertIndex: -1 insertIndex: -1
addedObject: {fileID: 0} addedObject: {fileID: 0}
- targetCorrespondingSourceObject: {fileID: 1976549912044134044, guid: 15ac0ed4c56c7784ea3ae9000fc2af1f, type: 3}
insertIndex: -1
addedObject: {fileID: 0}
- targetCorrespondingSourceObject: {fileID: 946049230122111055, guid: 15ac0ed4c56c7784ea3ae9000fc2af1f, type: 3}
insertIndex: -1
addedObject: {fileID: 0}
- targetCorrespondingSourceObject: {fileID: 3884000982531321632, guid: 15ac0ed4c56c7784ea3ae9000fc2af1f, type: 3}
insertIndex: -1
addedObject: {fileID: 0}
- targetCorrespondingSourceObject: {fileID: 7360432264745744659, guid: 15ac0ed4c56c7784ea3ae9000fc2af1f, type: 3}
insertIndex: -1
addedObject: {fileID: 0}
- targetCorrespondingSourceObject: {fileID: 8473082740403796940, guid: 15ac0ed4c56c7784ea3ae9000fc2af1f, type: 3}
insertIndex: -1
addedObject: {fileID: 0}
- targetCorrespondingSourceObject: {fileID: 6177469951915325012, guid: 15ac0ed4c56c7784ea3ae9000fc2af1f, type: 3}
insertIndex: -1
addedObject: {fileID: 0}
- targetCorrespondingSourceObject: {fileID: 5895072277459163218, guid: 15ac0ed4c56c7784ea3ae9000fc2af1f, type: 3}
insertIndex: -1
addedObject: {fileID: 0}
- targetCorrespondingSourceObject: {fileID: 7578339981777433697, guid: 15ac0ed4c56c7784ea3ae9000fc2af1f, type: 3}
insertIndex: -1
addedObject: {fileID: 0}
- targetCorrespondingSourceObject: {fileID: 4516921380093177367, guid: 15ac0ed4c56c7784ea3ae9000fc2af1f, type: 3}
insertIndex: -1
addedObject: {fileID: 0}
- targetCorrespondingSourceObject: {fileID: 4005231931981461914, guid: 15ac0ed4c56c7784ea3ae9000fc2af1f, type: 3}
insertIndex: -1
addedObject: {fileID: 0}
- targetCorrespondingSourceObject: {fileID: 1201452541656116112, guid: 15ac0ed4c56c7784ea3ae9000fc2af1f, type: 3}
insertIndex: -1
addedObject: {fileID: 0}
- targetCorrespondingSourceObject: {fileID: 945459299333252523, guid: 15ac0ed4c56c7784ea3ae9000fc2af1f, type: 3}
insertIndex: -1
addedObject: {fileID: 0}
- targetCorrespondingSourceObject: {fileID: 4283788326543693181, guid: 15ac0ed4c56c7784ea3ae9000fc2af1f, type: 3} - targetCorrespondingSourceObject: {fileID: 4283788326543693181, guid: 15ac0ed4c56c7784ea3ae9000fc2af1f, type: 3}
insertIndex: -1 insertIndex: -1
addedObject: {fileID: 0} addedObject: {fileID: 0}
- targetCorrespondingSourceObject: {fileID: 8749833617750005817, guid: 15ac0ed4c56c7784ea3ae9000fc2af1f, type: 3} - targetCorrespondingSourceObject: {fileID: 8749833617750005817, guid: 15ac0ed4c56c7784ea3ae9000fc2af1f, type: 3}
insertIndex: -1 insertIndex: -1
addedObject: {fileID: 0} addedObject: {fileID: 0}
- targetCorrespondingSourceObject: {fileID: 7757089264771582114, guid: 15ac0ed4c56c7784ea3ae9000fc2af1f, type: 3}
insertIndex: -1
addedObject: {fileID: 0}
- targetCorrespondingSourceObject: {fileID: 5163240847006920611, guid: 15ac0ed4c56c7784ea3ae9000fc2af1f, type: 3} - targetCorrespondingSourceObject: {fileID: 5163240847006920611, guid: 15ac0ed4c56c7784ea3ae9000fc2af1f, type: 3}
insertIndex: -1 insertIndex: -1
addedObject: {fileID: 0} addedObject: {fileID: 0}
- targetCorrespondingSourceObject: {fileID: 8985312357426446245, guid: 15ac0ed4c56c7784ea3ae9000fc2af1f, type: 3} - targetCorrespondingSourceObject: {fileID: 8985312357426446245, guid: 15ac0ed4c56c7784ea3ae9000fc2af1f, type: 3}
insertIndex: -1 insertIndex: -1
addedObject: {fileID: 0} addedObject: {fileID: 0}
- targetCorrespondingSourceObject: {fileID: 7757089264771582114, guid: 15ac0ed4c56c7784ea3ae9000fc2af1f, type: 3}
insertIndex: -1
addedObject: {fileID: 0}
m_SourcePrefab: {fileID: 100100000, guid: 15ac0ed4c56c7784ea3ae9000fc2af1f, type: 3} m_SourcePrefab: {fileID: 100100000, guid: 15ac0ed4c56c7784ea3ae9000fc2af1f, type: 3}
--- !u!1660057539 &9223372036854775807 --- !u!1660057539 &9223372036854775807
SceneRoots: SceneRoots:

View File

@@ -203,6 +203,16 @@ namespace Marro.PacManUdon
Debug.LogError($"{gameObject} Just jumped by distance {distance}! position: {position}, nextPosition: {nextPosition}, direction: {direction}, offGrid: {offGrid}, ghostState: {ghostState}"); Debug.LogError($"{gameObject} Just jumped by distance {distance}! position: {position}, nextPosition: {nextPosition}, direction: {direction}, offGrid: {offGrid}, ghostState: {ghostState}");
} }
if (CrossesTileBorder(position, nextPosition, direction))
{
var inTunnel = pelletManager.IsInTunnel(nextPosition);
if (inTunnel != this.inTunnel)
{
this.inTunnel = inTunnel;
UpdateSpeed();
}
}
return nextPosition; return nextPosition;
} }
@@ -245,12 +255,18 @@ namespace Marro.PacManUdon
var gridPosition = PositionToGrid(position); var gridPosition = PositionToGrid(position);
var availableDirections = pelletManager.GetAvailableDirections(position); var availableDirections = pelletManager.GetAvailableDirections(position);
if (availableDirections == 0) if ((availableDirections & (int)PacManCollisionInfoType.NoTurn) != 0 )
{ {
return; return;
} }
availableDirections &= GetIllegalCardinalDirectionMask(direction); // Not allowed to turn around availableDirections &= ~(int)GetInverseDirection(direction); // Not allowed to turn around
if (!isScared && (availableDirections & (int)PacManCollisionInfoType.HorizontalOnly) != 0)
{
Debug.Log($"{name} Horizontal only!");
availableDirections &= ~0b0011;
}
target = GetGridTarget(gridPosition); target = GetGridTarget(gridPosition);
var newDirection = GetGridDirectionToTargetGreedy(availableDirections, gridPosition, target); var newDirection = GetGridDirectionToTargetGreedy(availableDirections, gridPosition, target);
@@ -264,23 +280,6 @@ namespace Marro.PacManUdon
SetDirection(newDirection); SetDirection(newDirection);
} }
private int GetIllegalCardinalDirectionMask(Direction direction)
{
switch (direction)
{
case Direction.Up:
return 0b1101;
case Direction.Down:
return 0b1110;
case Direction.Left:
return 0b0111;
case Direction.Right:
return 0b1011;
default:
return 0b1111;
}
}
private Vector2 ProcessPredefinedPath(Vector2 position, Vector2 nextPosition) private Vector2 ProcessPredefinedPath(Vector2 position, Vector2 nextPosition)
{ {
if (CrossesTileCenter(position, nextPosition, direction)) if (CrossesTileCenter(position, nextPosition, direction))
@@ -456,6 +455,7 @@ namespace Marro.PacManUdon
{ {
Direction bestDirection = Direction.Zero; Direction bestDirection = Direction.Zero;
float bestDistance = float.MaxValue; float bestDistance = float.MaxValue;
foreach (var direction in horizontalOnly ? horizontalDirections : cardinalDirections) foreach (var direction in horizontalOnly ? horizontalDirections : cardinalDirections)
{ {
if (((int)direction & availableDirections) == 0) if (((int)direction & availableDirections) == 0)
@@ -860,26 +860,6 @@ namespace Marro.PacManUdon
ghostManager.CapturedPacMan(); 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);
}
} }
} }
} }

View File

@@ -21,7 +21,7 @@ namespace Marro.PacManUdon
// Cannot be static, much to my annoyance // Cannot be static, much to my annoyance
public readonly Vector2[] directionVectors = public readonly Vector2[] directionVectors =
{ {
Vector2.zero, // 0 Vector2.zero, // 0
Vector2.down, // 1 Vector2.down, // 1
Vector2.up, // 2 Vector2.up, // 2
@@ -190,10 +190,10 @@ namespace Marro.PacManUdon
public static Vector2 PositionToGrid(Vector2 position) public static Vector2 PositionToGrid(Vector2 position)
{ {
return new Vector2((float)Math.Round(position.x), (float)Math.Round(position.y)); return new Vector2((float)Math.Round(position.x-0.5f)+0.5f, (float)Math.Round(position.y-0.5f)+0.5f);
} }
public static bool CrossesTileCenter(Vector2 currentPosition, Vector2 nextPosition, Direction direction) public static bool CrossesTileBorder(Vector2 currentPosition, Vector2 nextPosition, Direction direction)
{ {
bool result = false; bool result = false;
@@ -209,7 +209,7 @@ namespace Marro.PacManUdon
return result; return result;
} }
public static bool CrossesTileBorder(Vector2 currentPosition, Vector2 nextPosition, Direction direction) public static bool CrossesTileCenter(Vector2 currentPosition, Vector2 nextPosition, Direction direction)
{ {
bool result = false; bool result = false;

View File

@@ -148,8 +148,8 @@ namespace Marro.PacManUdon
var inputDirection = input.GetDirection(); var inputDirection = input.GetDirection();
if (!inputDirection.Equals(Direction.Zero) && !inputDirection.Equals(targetDirection) // Ignore neutral input or input in our current direction if (!inputDirection.Equals(Direction.Zero) && !inputDirection.Equals(targetDirection) // Ignore neutral input or input in our current direction
&& (!IsHorizontal(inputDirection) || (Math.Round(nextPosition.y, 5) - 0.5) % 1 != 0) // Target grid position near the edge of a tile may not be correct, ignore inputs near the border //&& (!IsHorizontal(inputDirection) || (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
&& (!IsVertical(inputDirection) || (Math.Round(nextPosition.x, 5) - 0.5) % 1 != 0) //&& (!IsVertical(inputDirection) || (Math.Round(nextPosition.y, 5) - 0.5) % 1 != 0)
&& !pelletManager.IsWallUpcoming(nextPosition, directionVectors[(int)inputDirection])) && !pelletManager.IsWallUpcoming(nextPosition, directionVectors[(int)inputDirection]))
{ // Check if the requested direction does not have a wall { // Check if the requested direction does not have a wall
if (IsHorizontal(inputDirection)) if (IsHorizontal(inputDirection))

View File

@@ -1,7 +1,6 @@
namespace Marro.PacManUdon namespace Marro.PacManUdon
{ {
using UnityEngine; using UnityEngine;
using VRC.Udon;
public enum PacManFruitType public enum PacManFruitType
{ {
@@ -50,110 +49,114 @@ namespace Marro.PacManUdon
Intermission3 Intermission3
} }
public enum PacManCollisionType public enum PacManCollisionInfoType
{ {
Empty = -1, Tunnel = 0b00100000,
Wall = -2, HorizontalOnly = 0b00010000, // Bit that indicates tiles on which ghosts are only allowed to go horizontal unless they're scared
NoTurn = 0b01000000,
Wall = 0b10000000,
} }
public enum PacManConsumableType public enum PacManConsumableType
{ {
None = -1, None = 255,
FruitLeft = -2, FruitLeft = 254,
FruitRight = -3, FruitRight = 253,
} }
public static class PacManConstants public static class PacManConstants
{ {
// Jagged or 2D arrays can't be static so we work with 1D arrays // Jagged or 2D arrays can't be static so we work with 1D arrays
public static int[] GetMazeCollisionInfo() => new int[] public static byte[] GetMazeCollisionInfo() => new byte[]
{ {
-02, -02, -02, -02, -02, -02, -02, -02, -02, -02, -02, -02, -02, -02, -02, -02, -02, -02, -02, -02, -02, -02, -02, -02, -02, -02, -02, -02, 192, 192, 192, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 192, 192, 192,
-02, 009, -01, -01, -01, -01, 013, -01, -01, -01, -01, -01, 005, -02, -02, 009, -01, -01, -01, -01, -01, 013, -01, -01, -01, -01, 005, -02, 192, 192, 200, 010, 076, 076, 076, 076, 076, 076, 076, 076, 076, 076, 014, 076, 076, 014, 076, 076, 076, 076, 076, 076, 076, 076, 076, 076, 006, 196, 192, 192,
-02, -01, -02, -02, -02, -02, -01, -02, -02, -02, -02, -02, -01, -02, -02, -01, -02, -02, -02, -02, -02, -01, -02, -02, -02, -02, -01, -02, 192, 192, 200, 067, 133, 193, 193, 193, 193, 193, 193, 193, 193, 137, 067, 133, 137, 067, 133, 193, 193, 193, 193, 193, 193, 193, 193, 137, 067, 196, 192, 192,
-02, -01, -02, -01, -01, -02, -01, -02, -01, -01, -01, -02, -01, -02, -02, -01, -02, -01, -01, -01, -02, -01, -02, -01, -01, -02, -01, -02, 192, 192, 200, 067, 134, 194, 194, 194, 194, 192, 192, 194, 194, 138, 067, 196, 200, 067, 134, 194, 194, 192, 192, 194, 194, 194, 194, 138, 067, 196, 192, 192,
-02, -01, -02, -02, -02, -02, -01, -02, -02, -02, -02, -02, -01, -02, -02, -01, -02, -02, -02, -02, -02, -01, -02, -02, -02, -02, -01, -02, 192, 192, 200, 009, 076, 014, 076, 076, 006, 196, 200, 010, 076, 076, 005, 196, 200, 009, 076, 076, 006, 196, 200, 010, 076, 076, 014, 076, 005, 196, 192, 192,
-02, 011, -01, -01, -01, -01, 015, -01, -01, 013, -01, -01, 014, -01, -01, 014, -01, -01, 013, -01, -01, 015, -01, -01, -01, -01, 007, -02, 192, 192, 192, 193, 137, 067, 133, 137, 067, 196, 200, 067, 133, 193, 193, 192, 192, 193, 193, 137, 067, 196, 200, 067, 133, 137, 067, 133, 193, 192, 192, 192,
-02, -01, -02, -02, -02, -02, -01, -02, -02, -01, -02, -02, -02, -02, -02, -02, -02, -02, -01, -02, -02, -01, -02, -02, -02, -02, -01, -02, 192, 192, 192, 194, 138, 067, 196, 200, 067, 134, 138, 067, 134, 194, 194, 194, 194, 194, 194, 138, 067, 134, 138, 067, 196, 200, 067, 134, 194, 192, 192, 192,
-02, -01, -02, -02, -02, -02, -01, -02, -02, -01, -02, -02, -02, -02, -02, -02, -02, -02, -01, -02, -02, -01, -02, -02, -02, -02, -01, -02, 192, 192, 200, 010, 076, 005, 196, 200, 011, 076, 076, 013, 076, 076, 030, 076, 076, 030, 076, 076, 013, 076, 076, 007, 196, 200, 009, 076, 006, 196, 192, 192,
-02, 010, -01, -01, -01, -01, 007, -02, -02, 010, -01, -01, 005, -02, -02, 009, -01, -01, 006, -02, -02, 011, -01, -01, -01, -01, 006, -02, 192, 192, 200, 067, 133, 193, 192, 200, 067, 133, 193, 193, 193, 137, 067, 133, 137, 067, 133, 193, 193, 193, 137, 067, 196, 192, 193, 137, 067, 196, 192, 192,
-02, -02, -02, -02, -02, -02, -01, -02, -02, -02, -02, -02, -01, -02, -02, -01, -02, -02, -02, -02, -02, -01, -02, -02, -02, -02, -02, -02, 192, 192, 200, 067, 134, 194, 194, 138, 067, 134, 194, 194, 194, 138, 067, 196, 200, 067, 134, 194, 194, 194, 138, 067, 134, 194, 194, 138, 067, 196, 192, 192,
013, 013, 013, 013, 005, -02, -01, -02, -02, -02, -02, -02, -01, -02, -02, -01, -02, -02, -02, -02, -02, -01, -02, 009, 013, 013, 013, 013, 192, 192, 200, 009, 076, 076, 076, 076, 015, 076, 076, 014, 076, 076, 005, 196, 200, 009, 076, 076, 014, 076, 076, 015, 076, 076, 076, 076, 005, 196, 192, 192,
015, 015, 015, 015, 007, -02, -01, -02, -02, 009, -01, -01, 014, -01, -01, 014, -01, -01, 005, -02, -02, -01, -02, 011, 015, 015, 015, 015, 192, 192, 192, 193, 193, 193, 193, 137, 067, 133, 137, 067, 133, 193, 193, 192, 192, 193, 193, 137, 067, 133, 137, 067, 133, 193, 193, 193, 193, 192, 192, 192,
014, 014, 014, 014, 006, -02, -01, -02, -02, -01, -02, -02, -02, -02, -02, -02, -02, -02, -01, -02, -02, -01, -02, 010, 014, 014, 014, 014, 192, 192, 192, 192, 192, 192, 192, 200, 067, 196, 200, 067, 134, 194, 194, 194, 194, 194, 194, 138, 067, 196, 200, 067, 196, 192, 192, 192, 192, 192, 192, 192,
-02, -02, -02, -02, -02, -02, -01, -02, -02, -01, -02, 009, 013, 013, 013, 013, 005, -02, -01, -02, -02, -01, -02, -02, -02, -02, -02, -02, 192, 192, 192, 192, 192, 192, 192, 200, 067, 196, 200, 011, 076, 076, 076, 076, 076, 076, 076, 076, 007, 196, 200, 067, 196, 192, 192, 192, 192, 192, 192, 192,
-01, -01, -01, -01, -01, -01, 015, -01, -01, 007, -02, 011, 015, 015, 015, 015, 007, -02, 011, -01, -01, 015, -01, -01, -01, -01, -01, -01, 192, 192, 192, 192, 192, 192, 192, 200, 067, 196, 200, 067, 133, 193, 193, 193, 193, 193, 193, 137, 067, 196, 200, 067, 196, 192, 192, 192, 192, 192, 192, 192,
-02, -02, -02, -02, -02, -02, -01, -02, -02, -01, -02, 010, 014, 014, 014, 014, 006, -02, -01, -02, -02, -01, -02, -02, -02, -02, -02, -02, 194, 194, 194, 194, 194, 194, 194, 138, 067, 134, 138, 067, 196, 192, 192, 192, 192, 192, 192, 200, 067, 134, 138, 067, 134, 194, 194, 194, 194, 194, 194, 194,
013, 013, 013, 013, 005, -02, -01, -02, -02, -01, -02, -02, -02, -02, -02, -02, -02, -02, -01, -02, -02, -01, -02, 009, 013, 013, 013, 013, 108, 108, 108, 108, 108, 108, 108, 076, 015, 076, 076, 007, 196, 192, 192, 192, 192, 192, 192, 200, 011, 076, 076, 015, 076, 108, 108, 108, 108, 108, 108, 108,
015, 015, 015, 015, 007, -02, -01, -02, -02, 011, -01, -01, -01, -01, -01, -01, -01, -01, 007, -02, -02, -01, -02, 011, 015, 015, 015, 015, 193, 193, 193, 193, 193, 193, 193, 137, 067, 133, 137, 067, 196, 192, 192, 192, 192, 192, 192, 200, 067, 133, 137, 067, 133, 193, 193, 193, 193, 193, 193, 193,
014, 014, 014, 014, 006, -02, -01, -02, -02, -01, -02, -02, -02, -02, -02, -02, -02, -02, -01, -02, -02, -01, -02, 010, 014, 014, 014, 014, 192, 192, 192, 192, 192, 192, 192, 200, 067, 196, 200, 067, 134, 194, 194, 194, 194, 194, 194, 138, 067, 196, 200, 067, 196, 192, 192, 192, 192, 192, 192, 192,
-02, -02, -02, -02, -02, -02, -01, -02, -02, -01, -02, -02, -02, -02, -02, -02, -02, -02, -01, -02, -02, -01, -02, -02, -02, -02, -02, -02, 192, 192, 192, 192, 192, 192, 192, 200, 067, 196, 200, 009, 076, 076, 030, 076, 076, 030, 076, 076, 005, 196, 200, 067, 196, 192, 192, 192, 192, 192, 192, 192,
-02, 009, -01, -01, -01, -01, 015, -01, -01, 014, -01, -01, 005, -02, -02, 009, -01, -01, 014, -01, -01, 015, -01, -01, -01, -01, 005, -02, 192, 192, 192, 192, 192, 192, 192, 200, 067, 196, 192, 193, 193, 137, 067, 133, 137, 067, 133, 193, 193, 192, 200, 067, 196, 192, 192, 192, 192, 192, 192, 192,
-02, -01, -02, -02, -02, -02, -01, -02, -02, -02, -02, -02, -01, -02, -02, -01, -02, -02, -02, -02, -02, -01, -02, -02, -02, -02, -01, -02, 192, 192, 192, 194, 194, 194, 194, 138, 067, 196, 192, 194, 194, 138, 067, 196, 200, 067, 134, 194, 194, 192, 200, 067, 134, 194, 194, 194, 194, 192, 192, 192,
-02, -01, -02, -02, -02, -02, -01, -02, -02, -02, -02, -02, -01, -02, -02, -01, -02, -02, -02, -02, -02, -01, -02, -02, -02, -02, -01, -02, 192, 192, 200, 010, 076, 076, 076, 076, 007, 196, 200, 010, 076, 076, 005, 196, 200, 009, 076, 076, 006, 196, 200, 011, 076, 076, 076, 076, 006, 196, 192, 192,
-02, 010, -01, 005, -02, -02, 011, -01, -01, 013, -01, -01, 014, -01, -01, 014, -01, -01, 013, -01, -01, 007, -02, -02, 009, -01, 006, -02, 192, 192, 200, 067, 133, 193, 193, 137, 067, 196, 200, 067, 133, 193, 193, 192, 192, 193, 193, 137, 067, 196, 200, 067, 133, 193, 193, 137, 067, 196, 192, 192,
-02, -02, -02, -01, -02, -02, -01, -02, -02, -01, -02, -02, -02, -02, -02, -02, -02, -02, -01, -02, -02, -01, -02, -02, -01, -02, -02, -02, 192, 192, 200, 067, 134, 194, 194, 138, 067, 134, 138, 067, 134, 194, 194, 194, 194, 194, 194, 138, 067, 134, 138, 067, 134, 194, 194, 138, 067, 196, 192, 192,
-02, -02, -02, -01, -02, -02, -01, -02, -02, -01, -02, -02, -02, -02, -02, -02, -02, -02, -01, -02, -02, -01, -02, -02, -01, -02, -02, -02, 192, 192, 200, 011, 076, 076, 076, 076, 015, 076, 076, 013, 076, 076, 014, 076, 076, 014, 076, 076, 013, 076, 076, 015, 076, 076, 076, 076, 007, 196, 192, 192,
-02, 009, -01, 014, -01, -01, 006, -02, -02, 010, -01, -01, 005, -02, -02, 009, -01, -01, 006, -02, -02, 010, -01, -01, 014, -01, 005, -02, 192, 192, 200, 067, 133, 193, 193, 137, 067, 133, 193, 193, 193, 137, 067, 133, 137, 067, 133, 193, 193, 193, 137, 067, 133, 193, 193, 137, 067, 196, 192, 192,
-02, -01, -02, -02, -02, -02, -02, -02, -02, -02, -02, -02, -01, -02, -02, -01, -02, -02, -02, -02, -02, -02, -02, -02, -02, -02, -01, -02, 192, 192, 200, 067, 196, 192, 192, 200, 067, 196, 192, 192, 192, 200, 067, 196, 200, 067, 196, 192, 192, 192, 200, 067, 196, 192, 192, 200, 067, 196, 192, 192,
-02, -01, -02, -02, -02, -02, -02, -02, -02, -02, -02, -02, -01, -02, -02, -01, -02, -02, -02, -02, -02, -02, -02, -02, -02, -02, -01, -02, 192, 192, 200, 067, 134, 194, 194, 138, 067, 134, 194, 194, 194, 138, 067, 196, 200, 067, 134, 194, 194, 194, 138, 067, 134, 194, 194, 138, 067, 196, 192, 192,
-02, 010, -01, -01, -01, -01, -01, -01, -01, -01, -01, -01, 014, -01, -01, 014, -01, -01, -01, -01, -01, -01, -01, -01, -01, -01, 006, -02, 192, 192, 200, 009, 076, 076, 076, 076, 013, 076, 076, 076, 076, 076, 005, 196, 200, 009, 076, 076, 076, 076, 076, 013, 076, 076, 076, 076, 005, 196, 192, 192,
-02, -02, -02, -02, -02, -02, -02, -02, -02, -02, -02, -02, -02, -02, -02, -02, -02, -02, -02, -02, -02, -02, -02, -02, -02, -02, -02, -02, 192, 192, 192, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 192, 192, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, 192, 192, 192,
192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192,
}; };
public static int[] GetMazePelletMap() => new int[] public static byte[] GetMazePelletMap() => new byte[]
{ {
-01, -01, -01, -01, -01, -01, -01, -01, -01, -01, -01, -01, -01, -01, -01, -01, -01, -01, -01, -01, -01, -01, -01, -01, -01, -01, -01, -01, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
-01, 215, 214, 213, 212, 211, 195, 194, 193, 192, 191, 190, 189, -01, -01, 177, 178, 179, 180, 181, 182, 151, 150, 149, 148, 147, 146, -01, 255, 255, 255, 021, 022, 023, 024, 025, 026, 027, 028, 029, 030, 031, 032, 033, 034, 035, 036, 037, 038, 039, 040, 041, 042, 043, 044, 045, 046, 255, 255, 255,
-01, 216, -01, -01, -01, -01, 196, -01, -01, -01, -01, -01, 188, -01, -01, 176, -01, -01, -01, -01, -01, 152, -01, -01, -01, -01, 145, -01, 255, 255, 255, 020, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 072, 255, 255, 071, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 047, 255, 255, 255,
-01, 003, -01, -01, -01, -01, 197, -01, -01, -01, -01, -01, 187, -01, -01, 175, -01, -01, -01, -01, -01, 153, -01, -01, -01, -01, 002, -01, 255, 255, 255, 019, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 073, 255, 255, 070, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 048, 255, 255, 255,
-01, 217, -01, -01, -01, -01, 198, -01, -01, -01, -01, -01, 186, -01, -01, 174, -01, -01, -01, -01, -01, 154, -01, -01, -01, -01, 144, -01, 255, 255, 255, 018, 017, 016, 015, 014, 013, 255, 255, 077, 076, 075, 074, 255, 255, 069, 068, 067, 066, 255, 255, 054, 053, 052, 051, 050, 049, 255, 255, 255,
-01, 218, 219, 220, 221, 222, 199, 200, 201, 202, 203, 204, 185, 184, 183, 173, 172, 171, 164, 163, 162, 155, 156, 157, 158, 159, 143, -01, 255, 255, 255, 255, 255, 080, 255, 255, 012, 255, 255, 078, 255, 255, 255, 255, 255, 255, 255, 255, 065, 255, 255, 055, 255, 255, 113, 255, 255, 255, 255, 255,
-01, 223, -01, -01, -01, -01, 230, -01, -01, 205, -01, -01, -01, -01, -01, -01, -01, -01, 165, -01, -01, 160, -01, -01, -01, -01, 142, -01, 255, 255, 255, 255, 255, 081, 255, 255, 011, 255, 255, 079, 255, 255, 255, 255, 255, 255, 255, 255, 064, 255, 255, 056, 255, 255, 114, 255, 255, 255, 255, 255,
-01, 224, -01, -01, -01, -01, 231, -01, -01, 206, -01, -01, -01, -01, -01, -01, -01, -01, 166, -01, -01, 161, -01, -01, -01, -01, 141, -01, 255, 255, 255, 000, 083, 082, 255, 255, 010, 009, 008, 007, 006, 005, 004, 255, 255, 063, 062, 061, 060, 059, 058, 057, 255, 255, 115, 116, 001, 255, 255, 255,
-01, 225, 226, 227, 228, 229, 232, -01, -01, 207, 208, 209, 210, -01, -01, 170, 169, 168, 167, -01, -01, 135, 136, 137, 138, 139, 140, -01, 255, 255, 255, 084, 255, 255, 255, 255, 093, 255, 255, 255, 255, 255, 101, 255, 255, 102, 255, 255, 255, 255, 255, 112, 255, 255, 255, 255, 117, 255, 255, 255,
-01, -01, -01, -01, -01, -01, 233, -01, -01, -01, -01, -01, -01, -01, -01, -01, -01, -01, -01, -01, -01, 134, -01, -01, -01, -01, -01, -01, 255, 255, 255, 085, 255, 255, 255, 255, 092, 255, 255, 255, 255, 255, 100, 255, 255, 103, 255, 255, 255, 255, 255, 111, 255, 255, 255, 255, 118, 255, 255, 255,
-01, -01, -01, -01, -01, -01, 234, -01, -01, -01, -01, -01, -01, -01, -01, -01, -01, -01, -01, -01, -01, 133, -01, -01, -01, -01, -01, -01, 255, 255, 255, 086, 087, 088, 089, 090, 091, 094, 095, 096, 097, 098, 099, 255, 255, 104, 105, 106, 107, 108, 109, 110, 123, 122, 121, 120, 119, 255, 255, 255,
-01, -01, -01, -01, -01, -01, 235, -01, -01, -01, -01, -01, -01, -01, -01, -01, -01, -01, -01, -01, -01, 132, -01, -01, -01, -01, -01, -01, 255, 255, 255, 255, 255, 255, 255, 255, 243, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 124, 255, 255, 255, 255, 255, 255, 255, 255,
-01, -01, -01, -01, -01, -01, 236, -01, -01, -01, -01, -01, -01, -01, -01, -01, -01, -01, -01, -01, -01, 131, -01, -01, -01, -01, -01, -01, 255, 255, 255, 255, 255, 255, 255, 255, 242, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 125, 255, 255, 255, 255, 255, 255, 255, 255,
-01, -01, -01, -01, -01, -01, 237, -01, -01, -01, -01, -01, -01, -01, -01, -01, -01, -01, -01, -01, -01, 130, -01, -01, -01, -01, -01, -01, 255, 255, 255, 255, 255, 255, 255, 255, 241, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 126, 255, 255, 255, 255, 255, 255, 255, 255,
-01, -01, -01, -01, -01, -01, 238, -01, -01, -01, -01, -01, -01, -01, -01, -01, -01, -01, -01, -01, -01, 129, -01, -01, -01, -01, -01, -01, 255, 255, 255, 255, 255, 255, 255, 255, 240, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 127, 255, 255, 255, 255, 255, 255, 255, 255,
-01, -01, -01, -01, -01, -01, 239, -01, -01, -01, -01, -01, -01, -01, -01, -01, -01, -01, -01, -01, -01, 128, -01, -01, -01, -01, -01, -01, 255, 255, 255, 255, 255, 255, 255, 255, 239, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 128, 255, 255, 255, 255, 255, 255, 255, 255,
-01, -01, -01, -01, -01, -01, 240, -01, -01, -01, -01, -01, -01, -01, -01, -01, -01, -01, -01, -01, -01, 127, -01, -01, -01, -01, -01, -01, 255, 255, 255, 255, 255, 255, 255, 255, 238, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 129, 255, 255, 255, 255, 255, 255, 255, 255,
-01, -01, -01, -01, -01, -01, 241, -01, -01, -01, -01, -01, -01, -02, -03, -01, -01, -01, -01, -01, -01, 126, -01, -01, -01, -01, -01, -01, 255, 255, 255, 255, 255, 255, 255, 255, 237, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 130, 255, 255, 255, 255, 255, 255, 255, 255,
-01, -01, -01, -01, -01, -01, 242, -01, -01, -01, -01, -01, -01, -01, -01, -01, -01, -01, -01, -01, -01, 125, -01, -01, -01, -01, -01, -01, 255, 255, 255, 255, 255, 255, 255, 255, 236, 255, 255, 255, 255, 255, 255, 254, 253, 255, 255, 255, 255, 255, 255, 131, 255, 255, 255, 255, 255, 255, 255, 255,
-01, -01, -01, -01, -01, -01, 243, -01, -01, -01, -01, -01, -01, -01, -01, -01, -01, -01, -01, -01, -01, 124, -01, -01, -01, -01, -01, -01, 255, 255, 255, 255, 255, 255, 255, 255, 235, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 132, 255, 255, 255, 255, 255, 255, 255, 255,
-01, 086, 087, 088, 089, 090, 091, 094, 095, 096, 097, 098, 099, -01, -01, 104, 105, 106, 107, 108, 109, 110, 123, 122, 121, 120, 119, -01, 255, 255, 255, 255, 255, 255, 255, 255, 234, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 133, 255, 255, 255, 255, 255, 255, 255, 255,
-01, 085, -01, -01, -01, -01, 092, -01, -01, -01, -01, -01, 100, -01, -01, 103, -01, -01, -01, -01, -01, 111, -01, -01, -01, -01, 118, -01, 255, 255, 255, 255, 255, 255, 255, 255, 233, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 134, 255, 255, 255, 255, 255, 255, 255, 255,
-01, 084, -01, -01, -01, -01, 093, -01, -01, -01, -01, -01, 101, -01, -01, 102, -01, -01, -01, -01, -01, 112, -01, -01, -01, -01, 117, -01, 255, 255, 255, 225, 226, 227, 228, 229, 232, 255, 255, 207, 208, 209, 210, 255, 255, 170, 169, 168, 167, 255, 255, 135, 136, 137, 138, 139, 140, 255, 255, 255,
-01, 000, 083, 082, -01, -01, 010, 009, 008, 007, 006, 005, 004, -01, -01, 063, 062, 061, 060, 059, 058, 057, -01, -01, 115, 116, 001, -01, 255, 255, 255, 224, 255, 255, 255, 255, 231, 255, 255, 206, 255, 255, 255, 255, 255, 255, 255, 255, 166, 255, 255, 161, 255, 255, 255, 255, 141, 255, 255, 255,
-01, -01, -01, 081, -01, -01, 011, -01, -01, 079, -01, -01, -01, -01, -01, -01, -01, -01, 064, -01, -01, 056, -01, -01, 114, -01, -01, -01, 255, 255, 255, 223, 255, 255, 255, 255, 230, 255, 255, 205, 255, 255, 255, 255, 255, 255, 255, 255, 165, 255, 255, 160, 255, 255, 255, 255, 142, 255, 255, 255,
-01, -01, -01, 080, -01, -01, 012, -01, -01, 078, -01, -01, -01, -01, -01, -01, -01, -01, 065, -01, -01, 055, -01, -01, 113, -01, -01, -01, 255, 255, 255, 218, 219, 220, 221, 222, 199, 200, 201, 202, 203, 204, 185, 184, 183, 173, 172, 171, 164, 163, 162, 155, 156, 157, 158, 159, 143, 255, 255, 255,
-01, 018, 017, 016, 015, 014, 013, -01, -01, 077, 076, 075, 074, -01, -01, 069, 068, 067, 066, -01, -01, 054, 053, 052, 051, 050, 049, -01, 255, 255, 255, 217, 255, 255, 255, 255, 198, 255, 255, 255, 255, 255, 186, 255, 255, 174, 255, 255, 255, 255, 255, 154, 255, 255, 255, 255, 144, 255, 255, 255,
-01, 019, -01, -01, -01, -01, -01, -01, -01, -01, -01, -01, 073, -01, -01, 070, -01, -01, -01, -01, -01, -01, -01, -01, -01, -01, 048, -01, 255, 255, 255, 003, 255, 255, 255, 255, 197, 255, 255, 255, 255, 255, 187, 255, 255, 175, 255, 255, 255, 255, 255, 153, 255, 255, 255, 255, 002, 255, 255, 255,
-01, 020, -01, -01, -01, -01, -01, -01, -01, -01, -01, -01, 072, -01, -01, 071, -01, -01, -01, -01, -01, -01, -01, -01, -01, -01, 047, -01, 255, 255, 255, 216, 255, 255, 255, 255, 196, 255, 255, 255, 255, 255, 188, 255, 255, 176, 255, 255, 255, 255, 255, 152, 255, 255, 255, 255, 145, 255, 255, 255,
-01, 021, 022, 023, 024, 025, 026, 027, 028, 029, 030, 031, 032, 033, 034, 035, 036, 037, 038, 039, 040, 041, 042, 043, 044, 045, 046, -01, 255, 255, 255, 215, 214, 213, 212, 211, 195, 194, 193, 192, 191, 190, 189, 255, 255, 177, 178, 179, 180, 181, 182, 151, 150, 149, 148, 147, 146, 255, 255, 255,
-01, -01, -01, -01, -01, -01, -01, -01, -01, -01, -01, -01, -01, -01, -01, -01, -01, -01, -01, -01, -01, -01, -01, -01, -01, -01, -01, -01, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
}; };
public static int[] GetMazePelletIndices() => new int[] public static int[] GetMazePelletIndices() => new int[]
{ {
645, 670, 110, 085, 656, 655, 654, 653, 652, 651, 650, 678, 706, 734, 733, 732, 227, 252, 892, 867, 238, 237, 236, 235, 234, 233, 232, 200, 168, 136, 135, 134,
731, 730, 729, 757, 785, 813, 814, 815, 816, 817, 818, 819, 820, 821, 822, 823, 133, 132, 131, 099, 067, 035, 036, 037, 038, 039, 040, 041, 042, 043, 044, 045,
824, 825, 826, 827, 828, 829, 830, 831, 832, 833, 834, 835, 836, 837, 838, 810, 046, 047, 048, 049, 050, 051, 052, 053, 054, 055, 056, 057, 058, 059, 060, 092,
782, 754, 753, 752, 751, 750, 749, 721, 693, 665, 664, 663, 662, 661, 660, 659, 124, 156, 155, 154, 153, 152, 151, 183, 215, 247, 246, 245, 244, 243, 242, 241,
690, 718, 746, 745, 744, 743, 771, 799, 796, 768, 740, 739, 738, 737, 709, 681, 212, 180, 148, 147, 146, 145, 113, 081, 078, 110, 142, 141, 140, 139, 171, 203,
703, 675, 647, 646, 617, 589, 561, 562, 563, 564, 565, 566, 594, 622, 567, 568, 165, 197, 229, 228, 259, 291, 323, 324, 325, 326, 327, 328, 296, 264, 329, 330,
569, 570, 571, 572, 600, 628, 631, 603, 575, 576, 577, 578, 579, 580, 581, 609, 331, 332, 333, 334, 302, 270, 273, 305, 337, 338, 339, 340, 341, 342, 343, 311,
637, 724, 696, 668, 669, 642, 614, 586, 585, 584, 583, 582, 553, 525, 497, 469, 279, 186, 218, 250, 251, 284, 316, 348, 347, 346, 345, 344, 375, 407, 439, 471,
441, 413, 385, 357, 329, 301, 273, 245, 246, 247, 248, 249, 250, 222, 194, 166, 503, 535, 567, 599, 631, 663, 695, 727, 728, 729, 730, 731, 732, 764, 796, 828,
138, 082, 054, 053, 052, 051, 050, 049, 077, 105, 133, 161, 162, 163, 164, 165, 860, 924, 956, 955, 954, 953, 952, 951, 919, 887, 855, 823, 824, 825, 826, 827,
189, 217, 160, 159, 158, 186, 214, 242, 241, 240, 239, 157, 156, 155, 127, 099, 791, 759, 822, 821, 820, 788, 756, 724, 723, 722, 721, 819, 818, 817, 849, 881,
071, 043, 044, 045, 046, 047, 048, 154, 153, 152, 124, 096, 068, 040, 039, 038, 913, 945, 946, 947, 948, 949, 950, 816, 815, 814, 846, 878, 910, 942, 941, 940,
037, 036, 035, 034, 062, 090, 118, 146, 147, 148, 149, 150, 151, 177, 205, 233, 939, 938, 937, 936, 904, 872, 840, 808, 809, 810, 811, 812, 813, 779, 747, 715,
234, 235, 236, 033, 032, 031, 030, 029, 057, 113, 141, 142, 143, 144, 145, 169, 716, 717, 718, 935, 934, 933, 932, 931, 899, 835, 803, 804, 805, 806, 807, 771,
197, 225, 226, 227, 228, 229, 174, 202, 230, 258, 286, 314, 342, 370, 398, 426, 739, 707, 708, 709, 710, 711, 776, 744, 712, 680, 648, 616, 584, 552, 520, 488,
454, 482, 510, 538, 456, 424, 392, 360,
}; };
public static GameObject[] ComponentsToGameObjects(Component[] components, bool skipFirstComponent = false) public static GameObject[] ComponentsToGameObjects(Component[] components, bool skipFirstComponent = false)

View File

@@ -651,17 +651,11 @@ MonoBehaviour:
Entry: 1 Entry: 1
Data: collisionMap Data: collisionMap
- Name: <UserType>k__BackingField - Name: <UserType>k__BackingField
Entry: 7 Entry: 9
Data: 36|System.RuntimeType, mscorlib Data: 33
- Name:
Entry: 1
Data: System.Int32[], mscorlib
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField - Name: <SystemType>k__BackingField
Entry: 9 Entry: 9
Data: 36 Data: 33
- Name: <SyncMode>k__BackingField - Name: <SyncMode>k__BackingField
Entry: 7 Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -676,7 +670,7 @@ MonoBehaviour:
Data: false Data: false
- Name: _fieldAttributes - Name: _fieldAttributes
Entry: 7 Entry: 7
Data: 37|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib Data: 36|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name: - Name:
Entry: 12 Entry: 12
Data: 0 Data: 0
@@ -700,16 +694,16 @@ MonoBehaviour:
Data: pelletMap Data: pelletMap
- Name: $v - Name: $v
Entry: 7 Entry: 7
Data: 38|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor Data: 37|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField - Name: <Name>k__BackingField
Entry: 1 Entry: 1
Data: pelletMap Data: pelletMap
- Name: <UserType>k__BackingField - Name: <UserType>k__BackingField
Entry: 9 Entry: 9
Data: 36 Data: 33
- Name: <SystemType>k__BackingField - Name: <SystemType>k__BackingField
Entry: 9 Entry: 9
Data: 36 Data: 33
- Name: <SyncMode>k__BackingField - Name: <SyncMode>k__BackingField
Entry: 7 Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -724,7 +718,7 @@ MonoBehaviour:
Data: false Data: false
- Name: _fieldAttributes - Name: _fieldAttributes
Entry: 7 Entry: 7
Data: 39|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib Data: 38|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name: - Name:
Entry: 12 Entry: 12
Data: 0 Data: 0

View File

@@ -27,11 +27,11 @@ namespace Marro.PacManUdon
byte[] syncedPelletsCollected; byte[] syncedPelletsCollected;
int[] collisionMap; byte[] collisionMap;
int[] pelletMap; byte[] pelletMap;
const int mazeWidth = 28; const int mazeWidth = 32;
const int mazeHeight = 31; const int mazeHeight = 32;
public void Initialize(GameManager gameManager, BonusFruit bonusFruit) public void Initialize(GameManager gameManager, BonusFruit bonusFruit)
{ {
@@ -98,7 +98,20 @@ namespace Marro.PacManUdon
#region Collision #region Collision
public bool IsWallUpcoming(Vector2 position, Vector2 directionVector) public bool IsWallUpcoming(Vector2 position, Vector2 directionVector)
{ {
var result = GetTileAt(position + directionVector) == (int)PacManCollisionType.Wall; var index = GetTilemapIndex(position + directionVector);
var tile = collisionMap[index];
var result = (tile & (int)PacManCollisionInfoType.Wall) != 0;
Debug.Log($"IsWallUpcoming {position}, {directionVector}. index {index}, tile {tile}, result {result}, collisionMap.Length {collisionMap.Length}");
return result;
}
public bool IsInTunnel(Vector2 position)
{
var result = (collisionMap[GetTilemapIndex(position)] & (int)PacManCollisionInfoType.Tunnel) != 0;
if (result)
{
Debug.Log($"In tunnel at {position}");
}
return result; return result;
} }
@@ -134,22 +147,15 @@ namespace Marro.PacManUdon
public int GetAvailableDirections(Vector2 position) public int GetAvailableDirections(Vector2 position)
{ {
var directions = GetTileAt(position); var directions = collisionMap[GetTilemapIndex(position)];
if (directions <= 0)
{
return 0;
}
return directions; return directions;
} }
private int GetTileAt(Vector2 position) => collisionMap[GetTilemapIndex(position)];
internal static int GetTilemapIndex(Vector2 position) internal static int GetTilemapIndex(Vector2 position)
{ {
position = Clamp(position, 0, mazeWidth - 1, 1 - mazeHeight, 0); position = Clamp(position, 0, mazeWidth - 1, 0, mazeHeight - 1);
var index = (int)(position.x + 0.5) - (int)(position.y - 0.5) * mazeWidth; var index = (int)position.x + (int)position.y * mazeWidth;
return index; return index;
} }
#endregion #endregion
@@ -162,7 +168,7 @@ namespace Marro.PacManUdon
return PelletType.None; return PelletType.None;
} }
pelletMap[tilemapIndex] = -1; pelletMap[tilemapIndex] = (byte)PacManConsumableType.None;
var pellet = pellets[tile]; var pellet = pellets[tile];
pellet.gameObject.SetActive(false); pellet.gameObject.SetActive(false);

View File

@@ -20,7 +20,7 @@ MonoBehaviour:
compiledVersion: 2 compiledVersion: 2
behaviourSyncMode: 0 behaviourSyncMode: 0
hasInteractEvent: 0 hasInteractEvent: 0
scriptID: 6724330659013342737 scriptID: 1069201558343068808
serializationData: serializationData:
SerializedFormat: 2 SerializedFormat: 2
SerializedBytes: SerializedBytes:

View File

@@ -6,202 +6,220 @@ using UnityEngine.UIElements;
using VRC.SDKBase; using VRC.SDKBase;
using VRC.Udon; using VRC.Udon;
public class MazeDefinitionGenerator : UdonSharpBehaviour namespace Marro.PacManUdon.Dev
{ {
public BonusFruit bonusFruit; enum CollisionMap
public PelletManager pelletManager;
void Start()
{ {
PrintPelletMap(); Wall = 0x00,
PrintMazeMap(); Open = 0xFF,
Tunnel = 0x61,
HorizontalOnly = 0x56,
} }
public class MazeDefinitionGenerator : UdonSharpBehaviour
private void PrintPelletMap()
{ {
var width = 28; public BonusFruit bonusFruit;
var height = 31; public PelletManager pelletManager;
var pellets = pelletManager.gameObject.GetComponentsInChildren<Pellet>(includeInactive: true); const int width = 32;
const int height = 32;
int[] map = new int[width * height]; void Start()
int[] pelletLocations = new int[pellets.Length];
for (int i = 0; i < map.Length; i++)
{ {
map[i] = -1; PrintPelletMap();
PrintMazeMap();
} }
for (int i = 0; i < pellets.Length; i++) private void PrintPelletMap()
{ {
Pellet pellet = pellets[i]; var pellets = pelletManager.gameObject.GetComponentsInChildren<Pellet>(includeInactive: true);
var position = GridMover.PositionToGrid(new Vector2(pellet.transform.localPosition.x, -pellet.transform.localPosition.y));
var index = (int)position.x + (int)position.y * width;
map[index] = i;
pelletLocations[i] = index;
}
WriteBonusFruitTiles(map); int[] map = new int[width * height];
int[] pelletLocations = new int[pellets.Length];
PrintMap(map, width); for (int i = 0; i < map.Length; i++)
PrintMap(pelletLocations, 16);
}
private void WriteBonusFruitTiles(int[] map)
{
var position = bonusFruit.transform.localPosition;
var leftTileIndex = PelletManager.GetTilemapIndex(new Vector2(position.x - 0.5f, position.y));
map[leftTileIndex] = (int)PacManConsumableType.FruitLeft;
var rightTileIndex = PelletManager.GetTilemapIndex(new Vector2(position.x + 0.5f, position.y));
map[rightTileIndex] = (int)PacManConsumableType.FruitRight;
}
private void PrintMazeMap()
{
var width = 28;
var height = 31;
int[] map = new int[width * height];
var collisionMap = GetCollisionMap();
for (int i = 0; i < map.Length; i++)
{
if (collisionMap[i])
{ {
map[i] = (int)PacManCollisionType.Wall; map[i] = (int)PacManConsumableType.None;
continue;
} }
map[i] = GetGhostTurnInformation(collisionMap, i, width, height); for (int i = 0; i < pellets.Length; i++)
}
PrintMap(map, width);
}
private int GetGhostTurnInformation(bool[] collisionMap, int i, int width, int height)
{
var availableDirections = 0;
var totalAvailableDirections = 0;
if (!collisionMap[GetTilemapIndex(i, Vector2.up, width, height)])
{
availableDirections |= 0b0001;
totalAvailableDirections += 1;
}
if (!collisionMap[GetTilemapIndex(i, Vector2.down, width, height)])
{
availableDirections |= 0b0010;
totalAvailableDirections += 1;
}
if (!collisionMap[GetTilemapIndex(i, Vector2.left, width, height)])
{
availableDirections |= 0b0100;
totalAvailableDirections += 1;
}
if (!collisionMap[GetTilemapIndex(i, Vector2.right, width, height)])
{
availableDirections |= 0b1000;
totalAvailableDirections += 1;
}
if (totalAvailableDirections < 2)
{
return (int)PacManCollisionType.Empty;
}
if (availableDirections == 0b0011 || availableDirections == 0b1100)
{
return (int)PacManCollisionType.Empty;
}
return availableDirections;
}
private int GetTilemapIndex(int index, Vector2 direction, int width, int height)
{
var position = new Vector2(index % width, index / width) + direction;
position = Clamp(position, 0, width - 1, 0, height - 1);
var result = (int)position.x + (int)position.y * width;
return result;
}
private static Vector2 Clamp(Vector2 vector, float xMin, float xMax, float yMin, float yMax)
{
if (vector.x < xMin)
{
vector.x = xMin;
}
if (vector.x > xMax)
{
vector.x = xMax;
}
if (vector.y < yMin)
{
vector.y = yMin;
}
if (vector.y > yMax)
{
vector.y = yMax;
}
return vector;
}
private void PrintMap(int[] map, int width)
{
var result = "";
for (int i = 0; i < map.Length; i++)
{
if (map[i] < 0)
{ {
result += $"{map[i]:00}, "; Pellet pellet = pellets[i];
} var position = GridMover.PositionToGrid(new Vector2(pellet.transform.localPosition.x, pellet.transform.localPosition.y));
else var index = (int)position.x + (int)position.y * width;
{ map[index] = i;
result += $"{map[i]:000}, "; pelletLocations[i] = index;
} }
if (i % width == width - 1) WriteBonusFruitTiles(map);
{
result += "\n"; PrintMap(map, width);
} PrintMap(pelletLocations, 16);
} }
Debug.Log(result); private void WriteBonusFruitTiles(int[] map)
} {
var position = bonusFruit.transform.localPosition;
var leftTileIndex = PelletManager.GetTilemapIndex(new Vector2(position.x - 0.5f, position.y));
map[leftTileIndex] = (int)PacManConsumableType.FruitLeft;
var rightTileIndex = PelletManager.GetTilemapIndex(new Vector2(position.x + 0.5f, position.y));
map[rightTileIndex] = (int)PacManConsumableType.FruitRight;
}
public static bool[] GetCollisionMap() => new bool[] { private void PrintMazeMap()
true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true , {
true, false, false, false, false, false, false, false, false, false, false, false, false, true, true, false, false, false, false, false, false, false, false, false, false, false, false, true , int[] map = new int[width * height];
true, false, true, true, true, true, false, true, true, true, true, true, false, true, true, false, true, true, true, true, true, false, true, true, true, true, false, true , var collisionMap = GetCollisionMap();
true, false, true, false, false, true, false, true, false, false, false, true, false, true, true, false, true, false, false, false, true, false, true, false, false, true, false, true ,
true, false, true, true, true, true, false, true, true, true, true, true, false, true, true, false, true, true, true, true, true, false, true, true, true, true, false, true , for (int i = 0; i < map.Length; i++)
true, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, true , {
true, false, true, true, true, true, false, true, true, false, true, true, true, true, true, true, true, true, false, true, true, false, true, true, true, true, false, true , byte result = 0;
true, false, true, true, true, true, false, true, true, false, true, true, true, true, true, true, true, true, false, true, true, false, true, true, true, true, false, true , var tile = collisionMap[i];
true, false, false, false, false, false, false, true, true, false, false, false, false, true, true, false, false, false, false, true, true, false, false, false, false, false, false, true ,
true, true, true, true, true, true, false, true, true, true, true, true, false, true, true, false, true, true, true, true, true, false, true, true, true, true, true, true , if (tile == (byte)CollisionMap.Wall)
false, false, false, false, false, true, false, true, true, true, true, true, false, true, true, false, true, true, true, true, true, false, true, false, false, false, false, false , {
false, false, false, false, false, true, false, true, true, false, false, false, false, false, false, false, false, false, false, true, true, false, true, false, false, false, false, false , result |= (byte)PacManCollisionInfoType.Wall;
false, false, false, false, false, true, false, true, true, false, true, true, true, true, true, true, true, true, false, true, true, false, true, false, false, false, false, false , }
true, true, true, true, true, true, false, true, true, false, true, false, false, false, false, false, false, true, false, true, true, false, true, true, true, true, true, true ,
false, false, false, false, false, false, false, false, false, false, true, false, false, false, false, false, false, true, false, false, false, false, false, false, false, false, false, false , if (tile == (byte)CollisionMap.Tunnel)
true, true, true, true, true, true, false, true, true, false, true, false, false, false, false, false, false, true, false, true, true, false, true, true, true, true, true, true , {
false, false, false, false, false, true, false, true, true, false, true, true, true, true, true, true, true, true, false, true, true, false, true, false, false, false, false, false , result |= (byte)PacManCollisionInfoType.Tunnel;
false, false, false, false, false, true, false, true, true, false, false, false, false, false, false, false, false, false, false, true, true, false, true, false, false, false, false, false , }
false, false, false, false, false, true, false, true, true, false, true, true, true, true, true, true, true, true, false, true, true, false, true, false, false, false, false, false ,
true, true, true, true, true, true, false, true, true, false, true, true, true, true, true, true, true, true, false, true, true, false, true, true, true, true, true, true , if (tile == (byte)CollisionMap.HorizontalOnly)
true, false, false, false, false, false, false, false, false, false, false, false, false, true, true, false, false, false, false, false, false, false, false, false, false, false, false, true , {
true, false, true, true, true, true, false, true, true, true, true, true, false, true, true, false, true, true, true, true, true, false, true, true, true, true, false, true , result |= (byte)PacManCollisionInfoType.HorizontalOnly;
true, false, true, true, true, true, false, true, true, true, true, true, false, true, true, false, true, true, true, true, true, false, true, true, true, true, false, true , }
true, false, false, false, true, true, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, true, true, false, false, false, true ,
true, true, true, false, true, true, false, true, true, false, true, true, true, true, true, true, true, true, false, true, true, false, true, true, false, true, true, true , result |= GetGhostTurnInformation(collisionMap, i, width, height);
true, true, true, false, true, true, false, true, true, false, true, true, true, true, true, true, true, true, false, true, true, false, true, true, false, true, true, true ,
true, false, false, false, false, false, false, true, true, false, false, false, false, true, true, false, false, false, false, true, true, false, false, false, false, false, false, true , map[(i % width) + (height - i / width - 1) * width] = result;
true, false, true, true, true, true, true, true, true, true, true, true, false, true, true, false, true, true, true, true, true, true, true, true, true, true, false, true , }
true, false, true, true, true, true, true, true, true, true, true, true, false, true, true, false, true, true, true, true, true, true, true, true, true, true, false, true ,
true, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, true , PrintMap(map, width);
true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true }
};
private byte GetGhostTurnInformation(byte[] collisionMap, int i, int width, int height)
{
byte result = 0;
var totalAvailableDirections = 0;
if (collisionMap[GetTilemapIndex(i, Vector2.up, width, height)] != (byte)CollisionMap.Wall)
{
result |= 0b0001;
totalAvailableDirections += 1;
}
if (collisionMap[GetTilemapIndex(i, Vector2.down, width, height)] != (byte)CollisionMap.Wall)
{
result |= 0b0010;
totalAvailableDirections += 1;
}
if (collisionMap[GetTilemapIndex(i, Vector2.left, width, height)] != (byte)CollisionMap.Wall)
{
result |= 0b0100;
totalAvailableDirections += 1;
}
if (collisionMap[GetTilemapIndex(i, Vector2.right, width, height)] != (byte)CollisionMap.Wall)
{
result |= 0b1000;
totalAvailableDirections += 1;
}
if (totalAvailableDirections < 2
|| result == 0b0011 || result == 0b1100)
{
result |= (byte)PacManCollisionInfoType.NoTurn;
}
return result;
}
private int GetTilemapIndex(int index, Vector2 direction, int width, int height)
{
var position = new Vector2(index % width, index / width) + direction;
position = Clamp(position, 0, width - 1, 0, height - 1);
var result = (int)position.x + (int)position.y * width;
return result;
}
private static Vector2 Clamp(Vector2 vector, float xMin, float xMax, float yMin, float yMax)
{
if (vector.x < xMin)
{
vector.x = xMin;
}
if (vector.x > xMax)
{
vector.x = xMax;
}
if (vector.y < yMin)
{
vector.y = yMin;
}
if (vector.y > yMax)
{
vector.y = yMax;
}
return vector;
}
private void PrintMap(int[] map, int width)
{
var result = "";
for (int i = 0; i < map.Length; i++)
{
if (map[i] < 0)
{
result += $"{map[i]:00}, ";
}
else
{
result += $"{map[i]:000}, ";
}
if (i % width == width - 1)
{
result += "\n";
}
}
Debug.Log(result);
}
public static byte[] GetCollisionMap() => new byte[] {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0xff, 0xff, 0x56, 0xff, 0xff, 0x56, 0xff, 0xff, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x61, 0x61, 0x61, 0x61, 0x61, 0x61, 0x61, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x61, 0x61, 0x61, 0x61, 0x61, 0x61, 0x61,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x56, 0xff, 0xff, 0x56, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
}
} }