From f44929c109fa36880a97e33527be4564d62a63bd Mon Sep 17 00:00:00 2001 From: Marro64 Date: Thu, 18 Jun 2026 11:59:21 +0200 Subject: [PATCH] Cleaning --- Assets/Scripts/Ghost.asset | 628 ++++++++++-------- Assets/Scripts/Ghost.cs | 24 +- Assets/Scripts/GridMover.cs | 14 + Assets/Scripts/PacMan.asset | 368 +++++----- Assets/Scripts/PacMan.cs | 10 +- .../Sequences/AttractScreenIntroduction.cs | 5 +- Assets/Scripts/Sequences/Intermission1.cs | 6 +- Assets/Scripts/Sequences/Intermission2.cs | 10 +- Assets/Scripts/Sequences/Intermission3.cs | 10 +- 9 files changed, 558 insertions(+), 517 deletions(-) diff --git a/Assets/Scripts/Ghost.asset b/Assets/Scripts/Ghost.asset index 777e4e2..03a10cb 100644 --- a/Assets/Scripts/Ghost.asset +++ b/Assets/Scripts/Ghost.asset @@ -43,7 +43,7 @@ MonoBehaviour: Data: - Name: Entry: 12 - Data: 41 + Data: 42 - Name: Entry: 7 Data: @@ -169,25 +169,19 @@ MonoBehaviour: Data: - Name: $k Entry: 1 - Data: directionVectors + Data: targetDirection - Name: $v Entry: 7 Data: 10|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - Name: k__BackingField Entry: 1 - Data: directionVectors + Data: targetDirection - Name: k__BackingField - Entry: 7 - Data: 11|System.RuntimeType, mscorlib - - Name: - Entry: 1 - Data: UnityEngine.Vector2[], UnityEngine.CoreModule - - Name: - Entry: 8 - Data: + Entry: 9 + Data: 7 - Name: k__BackingField Entry: 9 - Data: 11 + Data: 8 - Name: k__BackingField Entry: 7 Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib @@ -202,7 +196,61 @@ MonoBehaviour: Data: false - Name: _fieldAttributes Entry: 7 - Data: 12|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + Data: 11|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + - Name: + 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: directionVectors + - Name: $v + Entry: 7 + Data: 12|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + - Name: k__BackingField + Entry: 1 + Data: directionVectors + - Name: k__BackingField + Entry: 7 + Data: 13|System.RuntimeType, mscorlib + - Name: + Entry: 1 + Data: UnityEngine.Vector2[], UnityEngine.CoreModule + - Name: + Entry: 8 + Data: + - Name: k__BackingField + Entry: 9 + Data: 13 + - Name: k__BackingField + Entry: 7 + Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib + - Name: + Entry: 6 + Data: + - Name: + Entry: 8 + Data: + - Name: k__BackingField + Entry: 5 + Data: false + - Name: _fieldAttributes + Entry: 7 + Data: 14|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - Name: Entry: 12 Data: 0 @@ -226,13 +274,13 @@ MonoBehaviour: Data: ghostType - Name: $v Entry: 7 - Data: 13|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + Data: 15|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - Name: k__BackingField Entry: 1 Data: ghostType - Name: k__BackingField Entry: 7 - Data: 14|System.RuntimeType, mscorlib + Data: 16|System.RuntimeType, mscorlib - Name: Entry: 1 Data: Marro.PacManUdon.PacManGhostType, Assembly-CSharp @@ -256,13 +304,13 @@ MonoBehaviour: Data: true - Name: _fieldAttributes Entry: 7 - Data: 15|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + Data: 17|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - Name: Entry: 12 Data: 1 - Name: Entry: 7 - Data: 16|UnityEngine.SerializeField, UnityEngine.CoreModule + Data: 18|UnityEngine.SerializeField, UnityEngine.CoreModule - Name: Entry: 8 Data: @@ -286,13 +334,13 @@ MonoBehaviour: Data: startState - Name: $v Entry: 7 - Data: 17|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + Data: 19|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - Name: k__BackingField Entry: 1 Data: startState - Name: k__BackingField Entry: 7 - Data: 18|System.RuntimeType, mscorlib + Data: 20|System.RuntimeType, mscorlib - Name: Entry: 1 Data: Marro.PacManUdon.PacManGhostStartState, Assembly-CSharp @@ -316,13 +364,13 @@ MonoBehaviour: Data: true - Name: _fieldAttributes Entry: 7 - Data: 19|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + Data: 21|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - Name: Entry: 12 Data: 1 - Name: Entry: 7 - Data: 20|UnityEngine.SerializeField, UnityEngine.CoreModule + Data: 22|UnityEngine.SerializeField, UnityEngine.CoreModule - Name: Entry: 8 Data: @@ -346,13 +394,13 @@ MonoBehaviour: Data: ghostManager - Name: $v Entry: 7 - Data: 21|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + Data: 23|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - Name: k__BackingField Entry: 1 Data: ghostManager - Name: k__BackingField Entry: 7 - Data: 22|System.RuntimeType, mscorlib + Data: 24|System.RuntimeType, mscorlib - Name: Entry: 1 Data: Marro.PacManUdon.GhostManager, Assembly-CSharp @@ -376,7 +424,7 @@ MonoBehaviour: Data: false - Name: _fieldAttributes Entry: 7 - Data: 23|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + Data: 25|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - Name: Entry: 12 Data: 0 @@ -400,13 +448,13 @@ MonoBehaviour: Data: collisionManager - Name: $v Entry: 7 - Data: 24|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + Data: 26|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - Name: k__BackingField Entry: 1 Data: collisionManager - Name: k__BackingField Entry: 7 - Data: 25|System.RuntimeType, mscorlib + Data: 27|System.RuntimeType, mscorlib - Name: Entry: 1 Data: Marro.PacManUdon.CollisionManager, Assembly-CSharp @@ -430,7 +478,7 @@ MonoBehaviour: Data: false - Name: _fieldAttributes Entry: 7 - Data: 26|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + Data: 28|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - Name: Entry: 12 Data: 0 @@ -454,13 +502,13 @@ MonoBehaviour: Data: animator - Name: $v Entry: 7 - Data: 27|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + Data: 29|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - Name: k__BackingField Entry: 1 Data: animator - Name: k__BackingField Entry: 7 - Data: 28|System.RuntimeType, mscorlib + Data: 30|System.RuntimeType, mscorlib - Name: Entry: 1 Data: UnityEngine.Animator, UnityEngine.AnimationModule @@ -469,7 +517,7 @@ MonoBehaviour: Data: - Name: k__BackingField Entry: 9 - Data: 28 + Data: 30 - Name: k__BackingField Entry: 7 Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib @@ -484,7 +532,7 @@ MonoBehaviour: Data: false - Name: _fieldAttributes Entry: 7 - Data: 29|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 @@ -508,13 +556,13 @@ MonoBehaviour: Data: renderer - Name: $v Entry: 7 - Data: 30|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + Data: 32|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - Name: k__BackingField Entry: 1 Data: renderer - Name: k__BackingField Entry: 7 - Data: 31|System.RuntimeType, mscorlib + Data: 33|System.RuntimeType, mscorlib - Name: Entry: 1 Data: UnityEngine.Renderer, UnityEngine.CoreModule @@ -523,7 +571,7 @@ MonoBehaviour: Data: - Name: k__BackingField Entry: 9 - Data: 31 + Data: 33 - Name: k__BackingField Entry: 7 Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib @@ -538,7 +586,7 @@ MonoBehaviour: Data: false - Name: _fieldAttributes Entry: 7 - Data: 32|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + Data: 34|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - Name: Entry: 12 Data: 0 @@ -562,13 +610,13 @@ MonoBehaviour: Data: pacMan - Name: $v Entry: 7 - Data: 33|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + Data: 35|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - Name: k__BackingField Entry: 1 Data: pacMan - Name: k__BackingField Entry: 7 - Data: 34|System.RuntimeType, mscorlib + Data: 36|System.RuntimeType, mscorlib - Name: Entry: 1 Data: Marro.PacManUdon.PacMan, Assembly-CSharp @@ -592,7 +640,7 @@ MonoBehaviour: Data: false - Name: _fieldAttributes Entry: 7 - Data: 35|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + Data: 37|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - Name: Entry: 12 Data: 0 @@ -616,13 +664,13 @@ MonoBehaviour: Data: blinky - Name: $v Entry: 7 - Data: 36|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + Data: 38|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - Name: k__BackingField Entry: 1 Data: blinky - Name: k__BackingField Entry: 7 - Data: 37|System.RuntimeType, mscorlib + Data: 39|System.RuntimeType, mscorlib - Name: Entry: 1 Data: Marro.PacManUdon.Ghost, Assembly-CSharp @@ -646,7 +694,7 @@ MonoBehaviour: Data: false - Name: _fieldAttributes Entry: 7 - Data: 38|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + Data: 40|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - Name: Entry: 12 Data: 0 @@ -670,13 +718,13 @@ MonoBehaviour: Data: scoreBonusDisplay - Name: $v Entry: 7 - Data: 39|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + Data: 41|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - Name: k__BackingField Entry: 1 Data: scoreBonusDisplay - Name: k__BackingField Entry: 7 - Data: 40|System.RuntimeType, mscorlib + Data: 42|System.RuntimeType, mscorlib - Name: Entry: 1 Data: Marro.PacManUdon.ScoreBonusDisplay, Assembly-CSharp @@ -700,7 +748,7 @@ MonoBehaviour: Data: false - Name: _fieldAttributes Entry: 7 - Data: 41|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + Data: 43|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - Name: Entry: 12 Data: 0 @@ -724,13 +772,13 @@ MonoBehaviour: Data: startPosition - Name: $v Entry: 7 - Data: 42|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + Data: 44|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - Name: k__BackingField Entry: 1 Data: startPosition - Name: k__BackingField Entry: 7 - Data: 43|System.RuntimeType, mscorlib + Data: 45|System.RuntimeType, mscorlib - Name: Entry: 1 Data: UnityEngine.Vector3, UnityEngine.CoreModule @@ -739,7 +787,7 @@ MonoBehaviour: Data: - Name: k__BackingField Entry: 9 - Data: 43 + Data: 45 - Name: k__BackingField Entry: 7 Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib @@ -754,7 +802,7 @@ MonoBehaviour: Data: false - Name: _fieldAttributes Entry: 7 - Data: 44|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + Data: 46|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - Name: Entry: 12 Data: 0 @@ -778,13 +826,13 @@ MonoBehaviour: Data: startRotation - Name: $v Entry: 7 - Data: 45|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + Data: 47|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - Name: k__BackingField Entry: 1 Data: startRotation - Name: k__BackingField Entry: 7 - Data: 46|System.RuntimeType, mscorlib + Data: 48|System.RuntimeType, mscorlib - Name: Entry: 1 Data: UnityEngine.Quaternion, UnityEngine.CoreModule @@ -793,7 +841,7 @@ MonoBehaviour: Data: - Name: k__BackingField Entry: 9 - Data: 46 + Data: 48 - Name: k__BackingField Entry: 7 Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib @@ -808,7 +856,7 @@ MonoBehaviour: Data: false - Name: _fieldAttributes Entry: 7 - Data: 47|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + Data: 49|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - Name: Entry: 12 Data: 0 @@ -832,13 +880,13 @@ MonoBehaviour: Data: homePosition - Name: $v Entry: 7 - Data: 48|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + Data: 50|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - Name: k__BackingField Entry: 1 Data: homePosition - Name: k__BackingField Entry: 7 - Data: 49|System.RuntimeType, mscorlib + Data: 51|System.RuntimeType, mscorlib - Name: Entry: 1 Data: UnityEngine.Vector2, UnityEngine.CoreModule @@ -847,55 +895,7 @@ MonoBehaviour: Data: - Name: k__BackingField Entry: 9 - Data: 49 - - Name: k__BackingField - Entry: 7 - Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib - - Name: - Entry: 6 - Data: - - Name: - Entry: 8 - Data: - - Name: k__BackingField - Entry: 5 - Data: false - - Name: _fieldAttributes - Entry: 7 - Data: 50|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: idlePosition1 - - Name: $v - Entry: 7 - Data: 51|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - - Name: k__BackingField - Entry: 1 - Data: idlePosition1 - - Name: k__BackingField - Entry: 9 - Data: 49 - - Name: k__BackingField - Entry: 9 - Data: 49 + Data: 51 - Name: k__BackingField Entry: 7 Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib @@ -931,19 +931,19 @@ MonoBehaviour: Data: - Name: $k Entry: 1 - Data: idlePosition2 + Data: idlePosition1 - Name: $v Entry: 7 Data: 53|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - Name: k__BackingField Entry: 1 - Data: idlePosition2 + Data: idlePosition1 - Name: k__BackingField Entry: 9 - Data: 49 + Data: 51 - Name: k__BackingField Entry: 9 - Data: 49 + Data: 51 - Name: k__BackingField Entry: 7 Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib @@ -979,19 +979,19 @@ MonoBehaviour: Data: - Name: $k Entry: 1 - Data: cornerPosition + Data: idlePosition2 - Name: $v Entry: 7 Data: 55|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - Name: k__BackingField Entry: 1 - Data: cornerPosition + Data: idlePosition2 - Name: k__BackingField Entry: 9 - Data: 49 + Data: 51 - Name: k__BackingField Entry: 9 - Data: 49 + Data: 51 - Name: k__BackingField Entry: 7 Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib @@ -1027,19 +1027,19 @@ MonoBehaviour: Data: - Name: $k Entry: 1 - Data: target + Data: cornerPosition - Name: $v Entry: 7 Data: 57|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - Name: k__BackingField Entry: 1 - Data: target + Data: cornerPosition - Name: k__BackingField Entry: 9 - Data: 49 + Data: 51 - Name: k__BackingField Entry: 9 - Data: 49 + Data: 51 - Name: k__BackingField Entry: 7 Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib @@ -1075,25 +1075,19 @@ MonoBehaviour: Data: - Name: $k Entry: 1 - Data: horizontalOnly + Data: target - Name: $v Entry: 7 Data: 59|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - Name: k__BackingField Entry: 1 - Data: horizontalOnly + Data: target - Name: k__BackingField - Entry: 7 - Data: 60|System.RuntimeType, mscorlib - - Name: - Entry: 1 - Data: System.Boolean, mscorlib - - Name: - Entry: 8 - Data: + Entry: 9 + Data: 51 - Name: k__BackingField Entry: 9 - Data: 60 + Data: 51 - Name: k__BackingField Entry: 7 Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib @@ -1108,7 +1102,7 @@ MonoBehaviour: Data: false - Name: _fieldAttributes Entry: 7 - Data: 61|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + Data: 60|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - Name: Entry: 12 Data: 0 @@ -1129,19 +1123,25 @@ MonoBehaviour: Data: - Name: $k Entry: 1 - Data: inTunnel + Data: horizontalOnly - Name: $v Entry: 7 - Data: 62|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + Data: 61|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - Name: k__BackingField Entry: 1 - Data: inTunnel + Data: horizontalOnly - Name: k__BackingField - Entry: 9 - Data: 60 + Entry: 7 + Data: 62|System.RuntimeType, mscorlib + - Name: + Entry: 1 + Data: System.Boolean, mscorlib + - Name: + Entry: 8 + Data: - Name: k__BackingField Entry: 9 - Data: 60 + Data: 62 - Name: k__BackingField Entry: 7 Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib @@ -1177,19 +1177,19 @@ MonoBehaviour: Data: - Name: $k Entry: 1 - Data: rngState + Data: inTunnel - Name: $v Entry: 7 Data: 64|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - Name: k__BackingField Entry: 1 - Data: rngState + Data: inTunnel - Name: k__BackingField Entry: 9 - Data: 8 + Data: 62 - Name: k__BackingField Entry: 9 - Data: 8 + Data: 62 - Name: k__BackingField Entry: 7 Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib @@ -1225,19 +1225,19 @@ MonoBehaviour: Data: - Name: $k Entry: 1 - Data: turnAroundSoon + Data: rngState - Name: $v Entry: 7 Data: 66|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - Name: k__BackingField Entry: 1 - Data: turnAroundSoon + Data: rngState - Name: k__BackingField Entry: 9 - Data: 60 + Data: 8 - Name: k__BackingField Entry: 9 - Data: 60 + Data: 8 - Name: k__BackingField Entry: 7 Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib @@ -1273,25 +1273,19 @@ MonoBehaviour: Data: - Name: $k Entry: 1 - Data: speed + Data: turnAroundSoon - Name: $v Entry: 7 Data: 68|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - Name: k__BackingField Entry: 1 - Data: speed + Data: turnAroundSoon - Name: k__BackingField - Entry: 7 - Data: 69|System.RuntimeType, mscorlib - - Name: - Entry: 1 - Data: System.Single, mscorlib - - Name: - Entry: 8 - Data: + Entry: 9 + Data: 62 - Name: k__BackingField Entry: 9 - Data: 69 + Data: 62 - Name: k__BackingField Entry: 7 Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib @@ -1306,7 +1300,61 @@ MonoBehaviour: Data: false - Name: _fieldAttributes Entry: 7 - Data: 70|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + Data: 69|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: speed + - Name: $v + Entry: 7 + Data: 70|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + - Name: k__BackingField + Entry: 1 + Data: speed + - Name: k__BackingField + Entry: 7 + Data: 71|System.RuntimeType, mscorlib + - Name: + Entry: 1 + Data: System.Single, mscorlib + - Name: + Entry: 8 + Data: + - Name: k__BackingField + Entry: 9 + Data: 71 + - Name: k__BackingField + Entry: 7 + Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib + - Name: + Entry: 6 + Data: + - Name: + Entry: 8 + Data: + - Name: k__BackingField + Entry: 5 + Data: false + - Name: _fieldAttributes + Entry: 7 + Data: 72|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - Name: Entry: 12 Data: 0 @@ -1330,13 +1378,13 @@ MonoBehaviour: Data: ghostState - Name: $v Entry: 7 - Data: 71|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + Data: 73|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - Name: k__BackingField Entry: 1 Data: ghostState - Name: k__BackingField Entry: 7 - Data: 72|System.RuntimeType, mscorlib + Data: 74|System.RuntimeType, mscorlib - Name: Entry: 1 Data: Marro.PacManUdon.PacManGhostState, Assembly-CSharp @@ -1358,54 +1406,6 @@ MonoBehaviour: - Name: k__BackingField Entry: 5 Data: false - - Name: _fieldAttributes - Entry: 7 - 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: isScared - - Name: $v - Entry: 7 - Data: 74|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - - Name: k__BackingField - Entry: 1 - Data: isScared - - Name: k__BackingField - Entry: 9 - Data: 60 - - Name: k__BackingField - Entry: 9 - Data: 60 - - Name: k__BackingField - Entry: 7 - Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib - - Name: - Entry: 6 - Data: - - Name: - Entry: 8 - Data: - - Name: k__BackingField - Entry: 5 - Data: false - Name: _fieldAttributes Entry: 7 Data: 75|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib @@ -1429,19 +1429,19 @@ MonoBehaviour: Data: - Name: $k Entry: 1 - Data: scattering + Data: isScared - Name: $v Entry: 7 Data: 76|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - Name: k__BackingField Entry: 1 - Data: scattering + Data: isScared - Name: k__BackingField Entry: 9 - Data: 60 + Data: 62 - Name: k__BackingField Entry: 9 - Data: 60 + Data: 62 - Name: k__BackingField Entry: 7 Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib @@ -1477,25 +1477,19 @@ MonoBehaviour: Data: - Name: $k Entry: 1 - Data: frozenState + Data: scattering - Name: $v Entry: 7 Data: 78|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - Name: k__BackingField Entry: 1 - Data: frozenState + Data: scattering - Name: k__BackingField - Entry: 7 - Data: 79|System.RuntimeType, mscorlib - - Name: - Entry: 1 - Data: Marro.PacManUdon.PacManGhostFrozenState, Assembly-CSharp - - Name: - Entry: 8 - Data: + Entry: 9 + Data: 62 - Name: k__BackingField Entry: 9 - Data: 8 + Data: 62 - Name: k__BackingField Entry: 7 Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib @@ -1510,7 +1504,7 @@ MonoBehaviour: Data: false - Name: _fieldAttributes Entry: 7 - Data: 80|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + Data: 79|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - Name: Entry: 12 Data: 0 @@ -1531,19 +1525,25 @@ MonoBehaviour: Data: - Name: $k Entry: 1 - Data: offGrid + Data: frozenState - Name: $v Entry: 7 - Data: 81|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + Data: 80|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - Name: k__BackingField Entry: 1 - Data: offGrid + Data: frozenState - Name: k__BackingField - Entry: 9 - Data: 60 + Entry: 7 + Data: 81|System.RuntimeType, mscorlib + - Name: + Entry: 1 + Data: Marro.PacManUdon.PacManGhostFrozenState, Assembly-CSharp + - Name: + Entry: 8 + Data: - Name: k__BackingField Entry: 9 - Data: 60 + Data: 8 - Name: k__BackingField Entry: 7 Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib @@ -1579,19 +1579,19 @@ MonoBehaviour: Data: - Name: $k Entry: 1 - Data: housePelletCounter + Data: offGrid - Name: $v Entry: 7 Data: 83|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - Name: k__BackingField Entry: 1 - Data: housePelletCounter + Data: offGrid - Name: k__BackingField Entry: 9 - Data: 8 + Data: 62 - Name: k__BackingField Entry: 9 - Data: 8 + Data: 62 - Name: k__BackingField Entry: 7 Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib @@ -1627,19 +1627,19 @@ MonoBehaviour: Data: - Name: $k Entry: 1 - Data: housePelletCounterActive + Data: housePelletCounter - Name: $v Entry: 7 Data: 85|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - Name: k__BackingField Entry: 1 - Data: housePelletCounterActive + Data: housePelletCounter - Name: k__BackingField Entry: 9 - Data: 60 + Data: 8 - Name: k__BackingField Entry: 9 - Data: 60 + Data: 8 - Name: k__BackingField Entry: 7 Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib @@ -1675,19 +1675,19 @@ MonoBehaviour: Data: - Name: $k Entry: 1 - Data: housePelletCounterLimit + Data: housePelletCounterActive - Name: $v Entry: 7 Data: 87|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - Name: k__BackingField Entry: 1 - Data: housePelletCounterLimit + Data: housePelletCounterActive - Name: k__BackingField Entry: 9 - Data: 8 + Data: 62 - Name: k__BackingField Entry: 9 - Data: 8 + Data: 62 - Name: k__BackingField Entry: 7 Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib @@ -1723,19 +1723,19 @@ MonoBehaviour: Data: - Name: $k Entry: 1 - Data: faceInStartingDirectionUntilUnfrozen + Data: housePelletCounterLimit - Name: $v Entry: 7 Data: 89|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - Name: k__BackingField Entry: 1 - Data: faceInStartingDirectionUntilUnfrozen + Data: housePelletCounterLimit - Name: k__BackingField Entry: 9 - Data: 60 + Data: 8 - Name: k__BackingField Entry: 9 - Data: 60 + Data: 8 - Name: k__BackingField Entry: 7 Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib @@ -1771,19 +1771,19 @@ MonoBehaviour: Data: - Name: $k Entry: 1 - Data: kinematic + Data: faceInStartingDirectionUntilUnfrozen - Name: $v Entry: 7 Data: 91|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - Name: k__BackingField Entry: 1 - Data: kinematic + Data: faceInStartingDirectionUntilUnfrozen - Name: k__BackingField Entry: 9 - Data: 60 + Data: 62 - Name: k__BackingField Entry: 9 - Data: 60 + Data: 62 - Name: k__BackingField Entry: 7 Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib @@ -1819,19 +1819,19 @@ MonoBehaviour: Data: - Name: $k Entry: 1 - Data: specialLook + Data: kinematic - Name: $v Entry: 7 Data: 93|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - Name: k__BackingField Entry: 1 - Data: specialLook + Data: kinematic - Name: k__BackingField Entry: 9 - Data: 60 + Data: 62 - Name: k__BackingField Entry: 9 - Data: 60 + Data: 62 - Name: k__BackingField Entry: 7 Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib @@ -1867,19 +1867,19 @@ MonoBehaviour: Data: - Name: $k Entry: 1 - Data: followingPredefinedPath + Data: specialLook - Name: $v Entry: 7 Data: 95|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - Name: k__BackingField Entry: 1 - Data: followingPredefinedPath + Data: specialLook - Name: k__BackingField Entry: 9 - Data: 60 + Data: 62 - Name: k__BackingField Entry: 9 - Data: 60 + Data: 62 - Name: k__BackingField Entry: 7 Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib @@ -1915,31 +1915,19 @@ MonoBehaviour: Data: - Name: $k Entry: 1 - Data: predefinedPath + Data: followingPredefinedPath - Name: $v Entry: 7 Data: 97|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - Name: k__BackingField Entry: 1 - Data: predefinedPath + Data: followingPredefinedPath - Name: k__BackingField - Entry: 7 - Data: 98|System.RuntimeType, mscorlib - - Name: - Entry: 1 - Data: Marro.PacManUdon.Direction[], Assembly-CSharp - - Name: - Entry: 8 - Data: + Entry: 9 + Data: 62 - Name: k__BackingField - Entry: 7 - Data: 99|System.RuntimeType, mscorlib - - Name: - Entry: 1 - Data: System.Int32[], mscorlib - - Name: - Entry: 8 - Data: + Entry: 9 + Data: 62 - Name: k__BackingField Entry: 7 Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib @@ -1954,8 +1942,7 @@ MonoBehaviour: Data: false - Name: _fieldAttributes Entry: 7 - Data: 100|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], - mscorlib + Data: 98|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - Name: Entry: 12 Data: 0 @@ -1976,19 +1963,31 @@ MonoBehaviour: Data: - Name: $k Entry: 1 - Data: predefinedPathIndex + Data: predefinedPath - Name: $v Entry: 7 - Data: 101|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + Data: 99|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - Name: k__BackingField Entry: 1 - Data: predefinedPathIndex + Data: predefinedPath - Name: k__BackingField - Entry: 9 - Data: 8 + Entry: 7 + Data: 100|System.RuntimeType, mscorlib + - Name: + Entry: 1 + Data: Marro.PacManUdon.Direction[], Assembly-CSharp + - Name: + Entry: 8 + Data: - Name: k__BackingField - Entry: 9 - Data: 8 + Entry: 7 + Data: 101|System.RuntimeType, mscorlib + - Name: + Entry: 1 + Data: System.Int32[], mscorlib + - Name: + Entry: 8 + Data: - Name: k__BackingField Entry: 7 Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib @@ -2025,13 +2024,13 @@ MonoBehaviour: Data: - Name: $k Entry: 1 - Data: k__BackingField + Data: predefinedPathIndex - Name: $v Entry: 7 Data: 103|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - Name: k__BackingField Entry: 1 - Data: k__BackingField + Data: predefinedPathIndex - Name: k__BackingField Entry: 9 Data: 8 @@ -2074,19 +2073,19 @@ MonoBehaviour: Data: - Name: $k Entry: 1 - Data: cardinalDirections + Data: k__BackingField - Name: $v Entry: 7 Data: 105|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - Name: k__BackingField Entry: 1 - Data: cardinalDirections + Data: k__BackingField - Name: k__BackingField Entry: 9 - Data: 98 + Data: 8 - Name: k__BackingField Entry: 9 - Data: 99 + Data: 8 - Name: k__BackingField Entry: 7 Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib @@ -2123,19 +2122,19 @@ MonoBehaviour: Data: - Name: $k Entry: 1 - Data: horizontalDirections + Data: cardinalDirections - Name: $v Entry: 7 Data: 107|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - Name: k__BackingField Entry: 1 - Data: horizontalDirections + Data: cardinalDirections - Name: k__BackingField Entry: 9 - Data: 98 + Data: 100 - Name: k__BackingField Entry: 9 - Data: 99 + Data: 101 - Name: k__BackingField Entry: 7 Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib @@ -2167,6 +2166,55 @@ MonoBehaviour: - Name: Entry: 8 Data: + - Name: + Entry: 7 + Data: + - Name: $k + Entry: 1 + Data: horizontalDirections + - Name: $v + Entry: 7 + Data: 109|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + - Name: k__BackingField + Entry: 1 + Data: horizontalDirections + - Name: k__BackingField + Entry: 9 + Data: 100 + - Name: k__BackingField + Entry: 9 + Data: 101 + - Name: k__BackingField + Entry: 7 + Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib + - Name: + Entry: 6 + Data: + - Name: + Entry: 8 + Data: + - Name: k__BackingField + Entry: 5 + Data: false + - Name: _fieldAttributes + Entry: 7 + Data: 110|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: diff --git a/Assets/Scripts/Ghost.cs b/Assets/Scripts/Ghost.cs index f76bbaf..8adeafc 100644 --- a/Assets/Scripts/Ghost.cs +++ b/Assets/Scripts/Ghost.cs @@ -70,7 +70,6 @@ namespace Marro.PacManUdon private bool isScared; private bool scattering; private PacManGhostFrozenState frozenState; - private Direction targetDirection; // Home private bool offGrid; @@ -174,8 +173,7 @@ namespace Marro.PacManUdon && CrossesTileCenter(position, nextPosition, direction)) { var newDirection = GetInverseDirection(direction); - SetDirection(newDirection); - SetTargetDirection(newDirection); + SetDirectionAndTargetDirection(newDirection); turnAroundSoon = false; return nextPosition; } @@ -249,8 +247,7 @@ namespace Marro.PacManUdon } if ((XAxisAlligned || YAxisAlligned) && offGrid) { - SetDirection(GetOffGridDirectionToTarget(nextPosition, target, direction)); - SetTargetDirection(direction); + SetDirectionAndTargetDirection(GetOffGridDirectionToTarget(nextPosition, target, direction)); // Debug.Log($"{gameObject} Alligned X Axis: {XAxisAlligned}, Y Axis: {YAxisAlligned} with position: {position}, new nextPosition: {nextPosition}, new target: {target}, now moving in direction {direction}"); // nextPosition = GridMover.GetNextPosition(position, direction, speed); } @@ -294,12 +291,6 @@ namespace Marro.PacManUdon SetDirection(targetDirection); } - protected void SetTargetDirection(Direction direction) - { - targetDirection = direction; - UpdateAnimator(); - } - private void ProcessPredefinedPath(Vector2 position, ref Vector2 nextPosition) { if (CrossesTileCenter(position, nextPosition, direction)) @@ -315,8 +306,7 @@ namespace Marro.PacManUdon // If we're at a Vector2.zero, we skip applying the direction and only increment. if (nextValidDirectionIndex == predefinedPathIndex) { - SetDirection(predefinedPath[nextValidDirectionIndex]); - SetTargetDirection(direction); + SetDirectionAndTargetDirection(predefinedPath[nextValidDirectionIndex]); nextPosition = PositionToGrid(nextPosition) + GetVector(direction) * 0.01f; // Check if we've reached the end of the path, which includes making sure the path doesn't end on Vector2.zero @@ -442,8 +432,7 @@ namespace Marro.PacManUdon case PacManGhostState.Exiting: offGrid = false; SetState(PacManGhostState.Normal); - SetDirection(Direction.Left); - SetTargetDirection(Direction.Left); + SetDirectionAndTargetDirection(Direction.Left); break; } } @@ -452,13 +441,12 @@ namespace Marro.PacManUdon { if (startHorizontal) { - SetDirection(GetOffGridDirectionToTarget(GetPosition(), newTarget, Direction.Right)); + SetDirectionAndTargetDirection(GetOffGridDirectionToTarget(GetPosition(), newTarget, Direction.Right)); } else { - SetDirection(GetOffGridDirectionToTarget(GetPosition(), newTarget, Direction.Down)); + SetDirectionAndTargetDirection(GetOffGridDirectionToTarget(GetPosition(), newTarget, Direction.Down)); } - SetTargetDirection(direction); // Debug.Log($"{gameObject} SetOffGridTarget with position {GetPosition()}, newTarget {newTarget}, startHorizontal {startHorizontal} resulted in direction {direction}"); target = newTarget; } diff --git a/Assets/Scripts/GridMover.cs b/Assets/Scripts/GridMover.cs index 573a0d1..7d6e511 100644 --- a/Assets/Scripts/GridMover.cs +++ b/Assets/Scripts/GridMover.cs @@ -18,6 +18,7 @@ namespace Marro.PacManUdon public abstract class GridMover : SyncedObject { protected Direction direction; + protected Direction targetDirection; // Cannot be static, much to my annoyance public readonly Vector2[] directionVectors = @@ -66,6 +67,19 @@ namespace Marro.PacManUdon UpdateAnimator(); } + protected void SetTargetDirection(Direction targetDirection) + { + this.targetDirection = targetDirection; + UpdateAnimator(); + } + + public void SetDirectionAndTargetDirection(Direction direction) + { + this.direction = direction; + this.targetDirection = direction; + UpdateAnimator(); + } + protected static Direction VectorToDirection(Vector2 vector) { var directionId = 0; diff --git a/Assets/Scripts/PacMan.asset b/Assets/Scripts/PacMan.asset index 93eb634..1215261 100644 --- a/Assets/Scripts/PacMan.asset +++ b/Assets/Scripts/PacMan.asset @@ -169,25 +169,19 @@ MonoBehaviour: Data: - Name: $k Entry: 1 - Data: directionVectors + Data: targetDirection - Name: $v Entry: 7 Data: 10|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - Name: k__BackingField Entry: 1 - Data: directionVectors + Data: targetDirection - Name: k__BackingField - Entry: 7 - Data: 11|System.RuntimeType, mscorlib - - Name: - Entry: 1 - Data: UnityEngine.Vector2[], UnityEngine.CoreModule - - Name: - Entry: 8 - Data: + Entry: 9 + Data: 7 - Name: k__BackingField Entry: 9 - Data: 11 + Data: 8 - Name: k__BackingField Entry: 7 Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib @@ -202,7 +196,61 @@ MonoBehaviour: Data: false - Name: _fieldAttributes Entry: 7 - Data: 12|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + Data: 11|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + - Name: + 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: directionVectors + - Name: $v + Entry: 7 + Data: 12|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + - Name: k__BackingField + Entry: 1 + Data: directionVectors + - Name: k__BackingField + Entry: 7 + Data: 13|System.RuntimeType, mscorlib + - Name: + Entry: 1 + Data: UnityEngine.Vector2[], UnityEngine.CoreModule + - Name: + Entry: 8 + Data: + - Name: k__BackingField + Entry: 9 + Data: 13 + - Name: k__BackingField + Entry: 7 + Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib + - Name: + Entry: 6 + Data: + - Name: + Entry: 8 + Data: + - Name: k__BackingField + Entry: 5 + Data: false + - Name: _fieldAttributes + Entry: 7 + Data: 14|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - Name: Entry: 12 Data: 0 @@ -226,13 +274,13 @@ MonoBehaviour: Data: gameManager - Name: $v Entry: 7 - Data: 13|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + Data: 15|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - Name: k__BackingField Entry: 1 Data: gameManager - Name: k__BackingField Entry: 7 - Data: 14|System.RuntimeType, mscorlib + Data: 16|System.RuntimeType, mscorlib - Name: Entry: 1 Data: Marro.PacManUdon.GameManager, Assembly-CSharp @@ -256,7 +304,7 @@ MonoBehaviour: Data: false - Name: _fieldAttributes Entry: 7 - Data: 15|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + Data: 17|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - Name: Entry: 12 Data: 0 @@ -280,13 +328,13 @@ MonoBehaviour: Data: input - Name: $v Entry: 7 - Data: 16|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + Data: 18|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - Name: k__BackingField Entry: 1 Data: input - Name: k__BackingField Entry: 7 - Data: 17|System.RuntimeType, mscorlib + Data: 19|System.RuntimeType, mscorlib - Name: Entry: 1 Data: Marro.PacManUdon.PlayerInput, Assembly-CSharp @@ -310,7 +358,7 @@ MonoBehaviour: Data: false - Name: _fieldAttributes Entry: 7 - Data: 18|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + Data: 20|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - Name: Entry: 12 Data: 0 @@ -334,13 +382,13 @@ MonoBehaviour: Data: collisionManager - Name: $v Entry: 7 - Data: 19|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + Data: 21|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - Name: k__BackingField Entry: 1 Data: collisionManager - Name: k__BackingField Entry: 7 - Data: 20|System.RuntimeType, mscorlib + Data: 22|System.RuntimeType, mscorlib - Name: Entry: 1 Data: Marro.PacManUdon.CollisionManager, Assembly-CSharp @@ -364,7 +412,7 @@ MonoBehaviour: Data: false - Name: _fieldAttributes Entry: 7 - Data: 21|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + Data: 23|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - Name: Entry: 12 Data: 0 @@ -388,13 +436,13 @@ MonoBehaviour: Data: defaultSpeed - Name: $v Entry: 7 - Data: 22|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + Data: 24|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - Name: k__BackingField Entry: 1 Data: defaultSpeed - Name: k__BackingField Entry: 7 - Data: 23|System.RuntimeType, mscorlib + Data: 25|System.RuntimeType, mscorlib - Name: Entry: 1 Data: System.Single, mscorlib @@ -403,55 +451,7 @@ MonoBehaviour: Data: - Name: k__BackingField Entry: 9 - Data: 23 - - Name: k__BackingField - Entry: 7 - Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib - - Name: - Entry: 6 - Data: - - Name: - Entry: 8 - Data: - - Name: k__BackingField - Entry: 5 - Data: false - - Name: _fieldAttributes - Entry: 7 - Data: 24|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - - Name: - Entry: 12 - Data: 0 - - Name: - Entry: 13 - Data: - - Name: - Entry: 8 - Data: - - Name: - Entry: 8 - Data: - - Name: - Entry: 8 - Data: - - Name: - Entry: 7 - Data: - - Name: $k - Entry: 1 - Data: powerPelletSpeed - - Name: $v - Entry: 7 - Data: 25|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - - Name: k__BackingField - Entry: 1 - Data: powerPelletSpeed - - Name: k__BackingField - Entry: 9 - Data: 23 - - Name: k__BackingField - Entry: 9 - Data: 23 + Data: 25 - Name: k__BackingField Entry: 7 Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib @@ -487,19 +487,19 @@ MonoBehaviour: Data: - Name: $k Entry: 1 - Data: speed + Data: powerPelletSpeed - Name: $v Entry: 7 Data: 27|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - Name: k__BackingField Entry: 1 - Data: speed + Data: powerPelletSpeed - Name: k__BackingField Entry: 9 - Data: 23 + Data: 25 - Name: k__BackingField Entry: 9 - Data: 23 + Data: 25 - Name: k__BackingField Entry: 7 Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib @@ -535,16 +535,64 @@ MonoBehaviour: Data: - Name: $k Entry: 1 - Data: startPosition + Data: speed - Name: $v Entry: 7 Data: 29|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + - Name: k__BackingField + Entry: 1 + Data: speed + - Name: k__BackingField + Entry: 9 + Data: 25 + - Name: k__BackingField + Entry: 9 + Data: 25 + - Name: k__BackingField + Entry: 7 + Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib + - Name: + Entry: 6 + Data: + - Name: + Entry: 8 + Data: + - Name: k__BackingField + Entry: 5 + Data: false + - Name: _fieldAttributes + Entry: 7 + Data: 30|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + - Name: + Entry: 12 + Data: 0 + - Name: + Entry: 13 + Data: + - Name: + Entry: 8 + Data: + - Name: + Entry: 8 + Data: + - Name: + Entry: 8 + Data: + - Name: + Entry: 7 + Data: + - Name: $k + Entry: 1 + Data: startPosition + - Name: $v + Entry: 7 + Data: 31|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - Name: k__BackingField Entry: 1 Data: startPosition - Name: k__BackingField Entry: 7 - Data: 30|System.RuntimeType, mscorlib + Data: 32|System.RuntimeType, mscorlib - Name: Entry: 1 Data: UnityEngine.Vector3, UnityEngine.CoreModule @@ -553,7 +601,7 @@ MonoBehaviour: Data: - Name: k__BackingField Entry: 9 - Data: 30 + Data: 32 - Name: k__BackingField Entry: 7 Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib @@ -568,7 +616,7 @@ MonoBehaviour: Data: false - Name: _fieldAttributes Entry: 7 - Data: 31|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + Data: 33|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - Name: Entry: 12 Data: 0 @@ -592,13 +640,13 @@ MonoBehaviour: Data: startRotation - Name: $v Entry: 7 - Data: 32|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + Data: 34|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - Name: k__BackingField Entry: 1 Data: startRotation - Name: k__BackingField Entry: 7 - Data: 33|System.RuntimeType, mscorlib + Data: 35|System.RuntimeType, mscorlib - Name: Entry: 1 Data: UnityEngine.Quaternion, UnityEngine.CoreModule @@ -607,7 +655,7 @@ MonoBehaviour: Data: - Name: k__BackingField Entry: 9 - Data: 33 + Data: 35 - Name: k__BackingField Entry: 7 Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib @@ -622,7 +670,7 @@ MonoBehaviour: Data: false - Name: _fieldAttributes Entry: 7 - Data: 34|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + Data: 36|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - Name: Entry: 12 Data: 0 @@ -646,13 +694,13 @@ MonoBehaviour: Data: animator - Name: $v Entry: 7 - Data: 35|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + Data: 37|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - Name: k__BackingField Entry: 1 Data: animator - Name: k__BackingField Entry: 7 - Data: 36|System.RuntimeType, mscorlib + Data: 38|System.RuntimeType, mscorlib - Name: Entry: 1 Data: UnityEngine.Animator, UnityEngine.AnimationModule @@ -661,7 +709,7 @@ MonoBehaviour: Data: - Name: k__BackingField Entry: 9 - Data: 36 + Data: 38 - Name: k__BackingField Entry: 7 Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib @@ -676,7 +724,7 @@ MonoBehaviour: Data: false - Name: _fieldAttributes Entry: 7 - Data: 37|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + Data: 39|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - Name: Entry: 12 Data: 0 @@ -700,13 +748,13 @@ MonoBehaviour: Data: renderer - Name: $v Entry: 7 - Data: 38|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + Data: 40|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - Name: k__BackingField Entry: 1 Data: renderer - Name: k__BackingField Entry: 7 - Data: 39|System.RuntimeType, mscorlib + Data: 41|System.RuntimeType, mscorlib - Name: Entry: 1 Data: UnityEngine.Renderer, UnityEngine.CoreModule @@ -715,7 +763,7 @@ MonoBehaviour: Data: - Name: k__BackingField Entry: 9 - Data: 39 + Data: 41 - Name: k__BackingField Entry: 7 Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib @@ -730,7 +778,7 @@ MonoBehaviour: Data: false - Name: _fieldAttributes Entry: 7 - Data: 40|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + Data: 42|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - Name: Entry: 12 Data: 0 @@ -754,13 +802,13 @@ MonoBehaviour: Data: hideUntilUnfrozen - Name: $v Entry: 7 - Data: 41|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + Data: 43|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - Name: k__BackingField Entry: 1 Data: hideUntilUnfrozen - Name: k__BackingField Entry: 7 - Data: 42|System.RuntimeType, mscorlib + Data: 44|System.RuntimeType, mscorlib - Name: Entry: 1 Data: System.Boolean, mscorlib @@ -769,55 +817,7 @@ MonoBehaviour: Data: - Name: k__BackingField Entry: 9 - Data: 42 - - Name: k__BackingField - Entry: 7 - Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib - - Name: - Entry: 6 - Data: - - Name: - Entry: 8 - Data: - - Name: k__BackingField - Entry: 5 - Data: false - - Name: _fieldAttributes - Entry: 7 - Data: 43|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: dead - - Name: $v - Entry: 7 - Data: 44|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - - Name: k__BackingField - Entry: 1 - Data: dead - - Name: k__BackingField - Entry: 9 - Data: 42 - - Name: k__BackingField - Entry: 9 - Data: 42 + Data: 44 - Name: k__BackingField Entry: 7 Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib @@ -853,19 +853,19 @@ MonoBehaviour: Data: - Name: $k Entry: 1 - Data: kinematic + Data: dead - Name: $v Entry: 7 Data: 46|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - Name: k__BackingField Entry: 1 - Data: kinematic + Data: dead - Name: k__BackingField Entry: 9 - Data: 42 + Data: 44 - Name: k__BackingField Entry: 9 - Data: 42 + Data: 44 - Name: k__BackingField Entry: 7 Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib @@ -901,19 +901,19 @@ MonoBehaviour: Data: - Name: $k Entry: 1 - Data: followingPredefinedPath + Data: kinematic - Name: $v Entry: 7 Data: 48|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - Name: k__BackingField Entry: 1 - Data: followingPredefinedPath + Data: kinematic - Name: k__BackingField Entry: 9 - Data: 42 + Data: 44 - Name: k__BackingField Entry: 9 - Data: 42 + Data: 44 - Name: k__BackingField Entry: 7 Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib @@ -949,31 +949,19 @@ MonoBehaviour: Data: - Name: $k Entry: 1 - Data: predefinedPath + Data: followingPredefinedPath - Name: $v Entry: 7 Data: 50|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - Name: k__BackingField Entry: 1 - Data: predefinedPath + Data: followingPredefinedPath - Name: k__BackingField - Entry: 7 - Data: 51|System.RuntimeType, mscorlib - - Name: - Entry: 1 - Data: Marro.PacManUdon.Direction[], Assembly-CSharp - - Name: - Entry: 8 - Data: + Entry: 9 + Data: 44 - Name: k__BackingField - Entry: 7 - Data: 52|System.RuntimeType, mscorlib - - Name: - Entry: 1 - Data: System.Int32[], mscorlib - - Name: - Entry: 8 - Data: + Entry: 9 + Data: 44 - Name: k__BackingField Entry: 7 Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib @@ -988,7 +976,7 @@ MonoBehaviour: Data: false - Name: _fieldAttributes Entry: 7 - Data: 53|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + Data: 51|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - Name: Entry: 12 Data: 0 @@ -1009,19 +997,31 @@ MonoBehaviour: Data: - Name: $k Entry: 1 - Data: predefinedPathIndex + Data: predefinedPath - Name: $v Entry: 7 - Data: 54|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + Data: 52|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - Name: k__BackingField Entry: 1 - Data: predefinedPathIndex + Data: predefinedPath - Name: k__BackingField - Entry: 9 - Data: 8 + Entry: 7 + Data: 53|System.RuntimeType, mscorlib + - Name: + Entry: 1 + Data: Marro.PacManUdon.Direction[], Assembly-CSharp + - Name: + Entry: 8 + Data: - Name: k__BackingField - Entry: 9 - Data: 8 + Entry: 7 + Data: 54|System.RuntimeType, mscorlib + - Name: + Entry: 1 + Data: System.Int32[], mscorlib + - Name: + Entry: 8 + Data: - Name: k__BackingField Entry: 7 Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib @@ -1057,16 +1057,16 @@ MonoBehaviour: Data: - Name: $k Entry: 1 - Data: targetDirection + Data: predefinedPathIndex - Name: $v Entry: 7 Data: 56|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - Name: k__BackingField Entry: 1 - Data: targetDirection + Data: predefinedPathIndex - Name: k__BackingField Entry: 9 - Data: 7 + Data: 8 - Name: k__BackingField Entry: 9 Data: 8 @@ -1114,10 +1114,10 @@ MonoBehaviour: Data: freezeSeconds - Name: k__BackingField Entry: 9 - Data: 23 + Data: 25 - Name: k__BackingField Entry: 9 - Data: 23 + Data: 25 - Name: k__BackingField Entry: 7 Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib @@ -1162,10 +1162,10 @@ MonoBehaviour: Data: frozen - Name: k__BackingField Entry: 9 - Data: 42 + Data: 44 - Name: k__BackingField Entry: 9 - Data: 42 + Data: 44 - Name: k__BackingField Entry: 7 Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib diff --git a/Assets/Scripts/PacMan.cs b/Assets/Scripts/PacMan.cs index 0aafe09..b27910a 100644 --- a/Assets/Scripts/PacMan.cs +++ b/Assets/Scripts/PacMan.cs @@ -25,7 +25,6 @@ namespace Marro.PacManUdon private Direction[] predefinedPath; private int predefinedPathIndex; - private Direction targetDirection; private float freezeSeconds; private bool frozen; @@ -187,8 +186,7 @@ namespace Marro.PacManUdon // If we're at a Vector2.zero, we skip applying the direction and only increment. if (nextValidDirectionIndex == predefinedPathIndex) { - SetDirection(predefinedPath[nextValidDirectionIndex]); - SetTargetDirection(predefinedPath[nextValidDirectionIndex]); + SetDirectionAndTargetDirection(predefinedPath[nextValidDirectionIndex]); nextPosition = PositionToGrid(nextPosition) + directionVectors[(int)direction] * 0.01f; // Check if we've reached the end of the path, which includes making sure the path doesn't end on Vector2.zero @@ -334,12 +332,6 @@ namespace Marro.PacManUdon renderer.enabled = visible; } - public void SetTargetDirection(Direction targetDirection) - { - this.targetDirection = targetDirection; - UpdateAnimator(); - } - public override void CollectSyncedData(byte[] data, ref int index, NetworkEventType eventType) { if (eventType != NetworkEventType.PacManTurn) diff --git a/Assets/Scripts/Sequences/AttractScreenIntroduction.cs b/Assets/Scripts/Sequences/AttractScreenIntroduction.cs index 93c9b74..cd940c2 100644 --- a/Assets/Scripts/Sequences/AttractScreenIntroduction.cs +++ b/Assets/Scripts/Sequences/AttractScreenIntroduction.cs @@ -100,7 +100,7 @@ namespace Marro.PacManUdon for (int i = 0; i < ghosts.Length; i++) { ghosts[i].SetPosition(attractScreenElements[17 + i].transform.localPosition); - ghosts[i].SetDirection(Direction.Left); + ghosts[i].SetDirectionAndTargetDirection(Direction.Left); ghosts[i].SetState(PacManGhostState.Normal); } break; @@ -119,8 +119,7 @@ namespace Marro.PacManUdon case 18: // Turn PacMan around after eating power pellet - pacMan.SetDirection(Direction.Right); - pacMan.SetTargetDirection(Direction.Right); + pacMan.SetDirectionAndTargetDirection(Direction.Right); break; case 19: diff --git a/Assets/Scripts/Sequences/Intermission1.cs b/Assets/Scripts/Sequences/Intermission1.cs index 3200dca..c9b7399 100644 --- a/Assets/Scripts/Sequences/Intermission1.cs +++ b/Assets/Scripts/Sequences/Intermission1.cs @@ -26,14 +26,14 @@ namespace Marro.PacManUdon pacMan.SetKinematic(true); pacMan.SetActive(true); pacMan.SetPosition(intermissionScreenElements[0].transform.localPosition); - pacMan.SetDirection(Direction.Left); + pacMan.SetDirectionAndTargetDirection(Direction.Left); ghostManager.SetLevel(5); ghostManager.SetKinematic(true); ghostManager.gameObject.SetActive(true); blinky.SetElroy(2); blinky.SetPosition(intermissionScreenElements[1].transform.localPosition); - blinky.SetDirection(Direction.Left); + blinky.SetDirectionAndTargetDirection(Direction.Left); blinky.SetState(PacManGhostState.Normal); SetFrozen(false); @@ -53,7 +53,7 @@ namespace Marro.PacManUdon break; case 4: // Pacman starts chasing ghosts - pacMan.SetDirection(Direction.Right); + pacMan.SetDirectionAndTargetDirection(Direction.Right); pacMan.BecomeBig(); break; case 5: diff --git a/Assets/Scripts/Sequences/Intermission2.cs b/Assets/Scripts/Sequences/Intermission2.cs index 588e5f8..1ff15dd 100644 --- a/Assets/Scripts/Sequences/Intermission2.cs +++ b/Assets/Scripts/Sequences/Intermission2.cs @@ -34,14 +34,14 @@ namespace Marro.PacManUdon pacMan.SetKinematic(true); pacMan.SetActive(true); pacMan.SetPosition(intermissionScreenElements[0].transform.localPosition); - pacMan.SetDirection(Direction.Left); + pacMan.SetDirectionAndTargetDirection(Direction.Left); ghostManager.SetLevel(5); ghostManager.SetKinematic(true); ghostManager.gameObject.SetActive(true); blinky.SetElroy(2); blinky.SetPosition(intermissionScreenElements[1].transform.localPosition); - blinky.SetDirection(Direction.Left); + blinky.SetDirectionAndTargetDirection(Direction.Left); blinky.SetState(PacManGhostState.Normal); SetFrozen(false); @@ -65,16 +65,16 @@ namespace Marro.PacManUdon case 8: // Blinky sprite updates with broken cover blinky.SetSpecialLook(true); - blinky.SetDirection(Direction.Up); + blinky.SetDirectionAndTargetDirection(Direction.Up); blinky.SetPosition(blinky.GetPosition() + new Vector2(-0.250f, 0f)); break; case 9: // Blinky looks at broken cover - blinky.SetDirection(Direction.Down); + blinky.SetDirectionAndTargetDirection(Direction.Down); break; case 10: // Cutscene starts to unload - blinky.SetDirection(Direction.Zero); + blinky.SetDirectionAndTargetDirection(Direction.Zero); break; case 11: // End cutscene diff --git a/Assets/Scripts/Sequences/Intermission3.cs b/Assets/Scripts/Sequences/Intermission3.cs index e01d943..6cb98e7 100644 --- a/Assets/Scripts/Sequences/Intermission3.cs +++ b/Assets/Scripts/Sequences/Intermission3.cs @@ -26,14 +26,14 @@ namespace Marro.PacManUdon pacMan.SetKinematic(true); pacMan.SetActive(true); pacMan.SetPosition(intermissionScreenElements[0].transform.localPosition); - pacMan.SetDirection(Direction.Left); + pacMan.SetDirectionAndTargetDirection(Direction.Left); ghostManager.SetLevel(5); ghostManager.SetKinematic(true); ghostManager.gameObject.SetActive(true); blinky.SetElroy(2); blinky.SetPosition(intermissionScreenElements[1].transform.localPosition); - blinky.SetDirection(Direction.Left); + blinky.SetDirectionAndTargetDirection(Direction.Left); blinky.SetState(PacManGhostState.Normal); blinky.SetSpecialLook(true); @@ -45,13 +45,13 @@ namespace Marro.PacManUdon break; case 3: // Reached end, freeze - pacMan.SetDirection(Direction.Zero); - blinky.SetDirection(Direction.Zero); + pacMan.SetDirectionAndTargetDirection(Direction.Zero); + blinky.SetDirectionAndTargetDirection(Direction.Zero); break; case 4: // Ghost runs back on screen blinky.SetPosition(intermissionScreenElements[3].transform.localPosition); - blinky.SetDirection(Direction.Right); + blinky.SetDirectionAndTargetDirection(Direction.Right); break; case 5: // End cutscene