This commit is contained in:
2026-06-18 11:59:21 +02:00
parent e4ffe97c03
commit f44929c109
9 changed files with 558 additions and 517 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -70,7 +70,6 @@ namespace Marro.PacManUdon
private bool isScared; private bool isScared;
private bool scattering; private bool scattering;
private PacManGhostFrozenState frozenState; private PacManGhostFrozenState frozenState;
private Direction targetDirection;
// Home // Home
private bool offGrid; private bool offGrid;
@@ -174,8 +173,7 @@ namespace Marro.PacManUdon
&& CrossesTileCenter(position, nextPosition, direction)) && CrossesTileCenter(position, nextPosition, direction))
{ {
var newDirection = GetInverseDirection(direction); var newDirection = GetInverseDirection(direction);
SetDirection(newDirection); SetDirectionAndTargetDirection(newDirection);
SetTargetDirection(newDirection);
turnAroundSoon = false; turnAroundSoon = false;
return nextPosition; return nextPosition;
} }
@@ -249,8 +247,7 @@ namespace Marro.PacManUdon
} }
if ((XAxisAlligned || YAxisAlligned) && offGrid) if ((XAxisAlligned || YAxisAlligned) && offGrid)
{ {
SetDirection(GetOffGridDirectionToTarget(nextPosition, target, direction)); SetDirectionAndTargetDirection(GetOffGridDirectionToTarget(nextPosition, target, direction));
SetTargetDirection(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}"); // 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); // nextPosition = GridMover.GetNextPosition(position, direction, speed);
} }
@@ -294,12 +291,6 @@ namespace Marro.PacManUdon
SetDirection(targetDirection); SetDirection(targetDirection);
} }
protected void SetTargetDirection(Direction direction)
{
targetDirection = direction;
UpdateAnimator();
}
private void ProcessPredefinedPath(Vector2 position, ref Vector2 nextPosition) private void ProcessPredefinedPath(Vector2 position, ref Vector2 nextPosition)
{ {
if (CrossesTileCenter(position, nextPosition, direction)) 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 we're at a Vector2.zero, we skip applying the direction and only increment.
if (nextValidDirectionIndex == predefinedPathIndex) if (nextValidDirectionIndex == predefinedPathIndex)
{ {
SetDirection(predefinedPath[nextValidDirectionIndex]); SetDirectionAndTargetDirection(predefinedPath[nextValidDirectionIndex]);
SetTargetDirection(direction);
nextPosition = PositionToGrid(nextPosition) + GetVector(direction) * 0.01f; 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 // 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: case PacManGhostState.Exiting:
offGrid = false; offGrid = false;
SetState(PacManGhostState.Normal); SetState(PacManGhostState.Normal);
SetDirection(Direction.Left); SetDirectionAndTargetDirection(Direction.Left);
SetTargetDirection(Direction.Left);
break; break;
} }
} }
@@ -452,13 +441,12 @@ namespace Marro.PacManUdon
{ {
if (startHorizontal) if (startHorizontal)
{ {
SetDirection(GetOffGridDirectionToTarget(GetPosition(), newTarget, Direction.Right)); SetDirectionAndTargetDirection(GetOffGridDirectionToTarget(GetPosition(), newTarget, Direction.Right));
} }
else 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}"); // Debug.Log($"{gameObject} SetOffGridTarget with position {GetPosition()}, newTarget {newTarget}, startHorizontal {startHorizontal} resulted in direction {direction}");
target = newTarget; target = newTarget;
} }

View File

@@ -18,6 +18,7 @@ namespace Marro.PacManUdon
public abstract class GridMover : SyncedObject public abstract class GridMover : SyncedObject
{ {
protected Direction direction; protected Direction direction;
protected Direction targetDirection;
// Cannot be static, much to my annoyance // Cannot be static, much to my annoyance
public readonly Vector2[] directionVectors = public readonly Vector2[] directionVectors =
@@ -66,6 +67,19 @@ namespace Marro.PacManUdon
UpdateAnimator(); 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) protected static Direction VectorToDirection(Vector2 vector)
{ {
var directionId = 0; var directionId = 0;

View File

@@ -169,25 +169,19 @@ MonoBehaviour:
Data: Data:
- Name: $k - Name: $k
Entry: 1 Entry: 1
Data: directionVectors Data: targetDirection
- Name: $v - Name: $v
Entry: 7 Entry: 7
Data: 10|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor Data: 10|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField - Name: <Name>k__BackingField
Entry: 1 Entry: 1
Data: directionVectors Data: targetDirection
- Name: <UserType>k__BackingField - Name: <UserType>k__BackingField
Entry: 7 Entry: 9
Data: 11|System.RuntimeType, mscorlib Data: 7
- Name:
Entry: 1
Data: UnityEngine.Vector2[], UnityEngine.CoreModule
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField - Name: <SystemType>k__BackingField
Entry: 9 Entry: 9
Data: 11 Data: 8
- Name: <SyncMode>k__BackingField - Name: <SyncMode>k__BackingField
Entry: 7 Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -202,7 +196,61 @@ MonoBehaviour:
Data: false Data: false
- Name: _fieldAttributes - Name: _fieldAttributes
Entry: 7 Entry: 7
Data: 12|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib Data: 11|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
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: <Name>k__BackingField
Entry: 1
Data: directionVectors
- Name: <UserType>k__BackingField
Entry: 7
Data: 13|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: UnityEngine.Vector2[], UnityEngine.CoreModule
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 9
Data: 13
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
- Name:
Entry: 6
Data:
- Name:
Entry: 8
Data:
- Name: <IsSerialized>k__BackingField
Entry: 5
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 14|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name: - Name:
Entry: 12 Entry: 12
Data: 0 Data: 0
@@ -226,13 +274,13 @@ MonoBehaviour:
Data: gameManager Data: gameManager
- Name: $v - Name: $v
Entry: 7 Entry: 7
Data: 13|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor Data: 15|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField - Name: <Name>k__BackingField
Entry: 1 Entry: 1
Data: gameManager Data: gameManager
- Name: <UserType>k__BackingField - Name: <UserType>k__BackingField
Entry: 7 Entry: 7
Data: 14|System.RuntimeType, mscorlib Data: 16|System.RuntimeType, mscorlib
- Name: - Name:
Entry: 1 Entry: 1
Data: Marro.PacManUdon.GameManager, Assembly-CSharp Data: Marro.PacManUdon.GameManager, Assembly-CSharp
@@ -256,7 +304,7 @@ MonoBehaviour:
Data: false Data: false
- Name: _fieldAttributes - Name: _fieldAttributes
Entry: 7 Entry: 7
Data: 15|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib Data: 17|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name: - Name:
Entry: 12 Entry: 12
Data: 0 Data: 0
@@ -280,13 +328,13 @@ MonoBehaviour:
Data: input Data: input
- Name: $v - Name: $v
Entry: 7 Entry: 7
Data: 16|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor Data: 18|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField - Name: <Name>k__BackingField
Entry: 1 Entry: 1
Data: input Data: input
- Name: <UserType>k__BackingField - Name: <UserType>k__BackingField
Entry: 7 Entry: 7
Data: 17|System.RuntimeType, mscorlib Data: 19|System.RuntimeType, mscorlib
- Name: - Name:
Entry: 1 Entry: 1
Data: Marro.PacManUdon.PlayerInput, Assembly-CSharp Data: Marro.PacManUdon.PlayerInput, Assembly-CSharp
@@ -310,7 +358,7 @@ MonoBehaviour:
Data: false Data: false
- Name: _fieldAttributes - Name: _fieldAttributes
Entry: 7 Entry: 7
Data: 18|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib Data: 20|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name: - Name:
Entry: 12 Entry: 12
Data: 0 Data: 0
@@ -334,13 +382,13 @@ MonoBehaviour:
Data: collisionManager Data: collisionManager
- Name: $v - Name: $v
Entry: 7 Entry: 7
Data: 19|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor Data: 21|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField - Name: <Name>k__BackingField
Entry: 1 Entry: 1
Data: collisionManager Data: collisionManager
- Name: <UserType>k__BackingField - Name: <UserType>k__BackingField
Entry: 7 Entry: 7
Data: 20|System.RuntimeType, mscorlib Data: 22|System.RuntimeType, mscorlib
- Name: - Name:
Entry: 1 Entry: 1
Data: Marro.PacManUdon.CollisionManager, Assembly-CSharp Data: Marro.PacManUdon.CollisionManager, Assembly-CSharp
@@ -364,7 +412,7 @@ MonoBehaviour:
Data: false Data: false
- Name: _fieldAttributes - Name: _fieldAttributes
Entry: 7 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: - Name:
Entry: 12 Entry: 12
Data: 0 Data: 0
@@ -388,13 +436,13 @@ MonoBehaviour:
Data: defaultSpeed Data: defaultSpeed
- Name: $v - Name: $v
Entry: 7 Entry: 7
Data: 22|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor Data: 24|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField - Name: <Name>k__BackingField
Entry: 1 Entry: 1
Data: defaultSpeed Data: defaultSpeed
- Name: <UserType>k__BackingField - Name: <UserType>k__BackingField
Entry: 7 Entry: 7
Data: 23|System.RuntimeType, mscorlib Data: 25|System.RuntimeType, mscorlib
- Name: - Name:
Entry: 1 Entry: 1
Data: System.Single, mscorlib Data: System.Single, mscorlib
@@ -403,55 +451,7 @@ MonoBehaviour:
Data: Data:
- Name: <SystemType>k__BackingField - Name: <SystemType>k__BackingField
Entry: 9 Entry: 9
Data: 23 Data: 25
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
- Name:
Entry: 6
Data:
- Name:
Entry: 8
Data:
- Name: <IsSerialized>k__BackingField
Entry: 5
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 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: <Name>k__BackingField
Entry: 1
Data: powerPelletSpeed
- Name: <UserType>k__BackingField
Entry: 9
Data: 23
- Name: <SystemType>k__BackingField
Entry: 9
Data: 23
- 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
@@ -487,19 +487,19 @@ MonoBehaviour:
Data: Data:
- Name: $k - Name: $k
Entry: 1 Entry: 1
Data: speed Data: powerPelletSpeed
- Name: $v - Name: $v
Entry: 7 Entry: 7
Data: 27|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor Data: 27|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField - Name: <Name>k__BackingField
Entry: 1 Entry: 1
Data: speed Data: powerPelletSpeed
- Name: <UserType>k__BackingField - Name: <UserType>k__BackingField
Entry: 9 Entry: 9
Data: 23 Data: 25
- Name: <SystemType>k__BackingField - Name: <SystemType>k__BackingField
Entry: 9 Entry: 9
Data: 23 Data: 25
- Name: <SyncMode>k__BackingField - Name: <SyncMode>k__BackingField
Entry: 7 Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -535,16 +535,64 @@ MonoBehaviour:
Data: Data:
- Name: $k - Name: $k
Entry: 1 Entry: 1
Data: startPosition Data: speed
- Name: $v - Name: $v
Entry: 7 Entry: 7
Data: 29|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor Data: 29|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: speed
- Name: <UserType>k__BackingField
Entry: 9
Data: 25
- Name: <SystemType>k__BackingField
Entry: 9
Data: 25
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
- Name:
Entry: 6
Data:
- Name:
Entry: 8
Data:
- Name: <IsSerialized>k__BackingField
Entry: 5
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 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: <Name>k__BackingField - Name: <Name>k__BackingField
Entry: 1 Entry: 1
Data: startPosition Data: startPosition
- Name: <UserType>k__BackingField - Name: <UserType>k__BackingField
Entry: 7 Entry: 7
Data: 30|System.RuntimeType, mscorlib Data: 32|System.RuntimeType, mscorlib
- Name: - Name:
Entry: 1 Entry: 1
Data: UnityEngine.Vector3, UnityEngine.CoreModule Data: UnityEngine.Vector3, UnityEngine.CoreModule
@@ -553,7 +601,7 @@ MonoBehaviour:
Data: Data:
- Name: <SystemType>k__BackingField - Name: <SystemType>k__BackingField
Entry: 9 Entry: 9
Data: 30 Data: 32
- 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
@@ -568,7 +616,7 @@ MonoBehaviour:
Data: false Data: false
- Name: _fieldAttributes - Name: _fieldAttributes
Entry: 7 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: - Name:
Entry: 12 Entry: 12
Data: 0 Data: 0
@@ -592,13 +640,13 @@ MonoBehaviour:
Data: startRotation Data: startRotation
- Name: $v - Name: $v
Entry: 7 Entry: 7
Data: 32|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor Data: 34|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField - Name: <Name>k__BackingField
Entry: 1 Entry: 1
Data: startRotation Data: startRotation
- Name: <UserType>k__BackingField - Name: <UserType>k__BackingField
Entry: 7 Entry: 7
Data: 33|System.RuntimeType, mscorlib Data: 35|System.RuntimeType, mscorlib
- Name: - Name:
Entry: 1 Entry: 1
Data: UnityEngine.Quaternion, UnityEngine.CoreModule Data: UnityEngine.Quaternion, UnityEngine.CoreModule
@@ -607,7 +655,7 @@ MonoBehaviour:
Data: Data:
- Name: <SystemType>k__BackingField - Name: <SystemType>k__BackingField
Entry: 9 Entry: 9
Data: 33 Data: 35
- 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
@@ -622,7 +670,7 @@ MonoBehaviour:
Data: false Data: false
- Name: _fieldAttributes - Name: _fieldAttributes
Entry: 7 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: - Name:
Entry: 12 Entry: 12
Data: 0 Data: 0
@@ -646,13 +694,13 @@ MonoBehaviour:
Data: animator Data: animator
- Name: $v - Name: $v
Entry: 7 Entry: 7
Data: 35|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: animator Data: animator
- Name: <UserType>k__BackingField - Name: <UserType>k__BackingField
Entry: 7 Entry: 7
Data: 36|System.RuntimeType, mscorlib Data: 38|System.RuntimeType, mscorlib
- Name: - Name:
Entry: 1 Entry: 1
Data: UnityEngine.Animator, UnityEngine.AnimationModule Data: UnityEngine.Animator, UnityEngine.AnimationModule
@@ -661,7 +709,7 @@ MonoBehaviour:
Data: Data:
- Name: <SystemType>k__BackingField - Name: <SystemType>k__BackingField
Entry: 9 Entry: 9
Data: 36 Data: 38
- 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 +724,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: 39|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name: - Name:
Entry: 12 Entry: 12
Data: 0 Data: 0
@@ -700,13 +748,13 @@ MonoBehaviour:
Data: renderer Data: renderer
- Name: $v - Name: $v
Entry: 7 Entry: 7
Data: 38|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor Data: 40|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField - Name: <Name>k__BackingField
Entry: 1 Entry: 1
Data: renderer Data: renderer
- Name: <UserType>k__BackingField - Name: <UserType>k__BackingField
Entry: 7 Entry: 7
Data: 39|System.RuntimeType, mscorlib Data: 41|System.RuntimeType, mscorlib
- Name: - Name:
Entry: 1 Entry: 1
Data: UnityEngine.Renderer, UnityEngine.CoreModule Data: UnityEngine.Renderer, UnityEngine.CoreModule
@@ -715,7 +763,7 @@ MonoBehaviour:
Data: Data:
- Name: <SystemType>k__BackingField - Name: <SystemType>k__BackingField
Entry: 9 Entry: 9
Data: 39 Data: 41
- Name: <SyncMode>k__BackingField - Name: <SyncMode>k__BackingField
Entry: 7 Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -730,7 +778,7 @@ MonoBehaviour:
Data: false Data: false
- Name: _fieldAttributes - Name: _fieldAttributes
Entry: 7 Entry: 7
Data: 40|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib Data: 42|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name: - Name:
Entry: 12 Entry: 12
Data: 0 Data: 0
@@ -754,13 +802,13 @@ MonoBehaviour:
Data: hideUntilUnfrozen Data: hideUntilUnfrozen
- Name: $v - Name: $v
Entry: 7 Entry: 7
Data: 41|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor Data: 43|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField - Name: <Name>k__BackingField
Entry: 1 Entry: 1
Data: hideUntilUnfrozen Data: hideUntilUnfrozen
- Name: <UserType>k__BackingField - Name: <UserType>k__BackingField
Entry: 7 Entry: 7
Data: 42|System.RuntimeType, mscorlib Data: 44|System.RuntimeType, mscorlib
- Name: - Name:
Entry: 1 Entry: 1
Data: System.Boolean, mscorlib Data: System.Boolean, mscorlib
@@ -769,55 +817,7 @@ MonoBehaviour:
Data: Data:
- Name: <SystemType>k__BackingField - Name: <SystemType>k__BackingField
Entry: 9 Entry: 9
Data: 42 Data: 44
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
- Name:
Entry: 6
Data:
- Name:
Entry: 8
Data:
- Name: <IsSerialized>k__BackingField
Entry: 5
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 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: <Name>k__BackingField
Entry: 1
Data: dead
- Name: <UserType>k__BackingField
Entry: 9
Data: 42
- Name: <SystemType>k__BackingField
Entry: 9
Data: 42
- 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
@@ -853,19 +853,19 @@ MonoBehaviour:
Data: Data:
- Name: $k - Name: $k
Entry: 1 Entry: 1
Data: kinematic Data: dead
- Name: $v - Name: $v
Entry: 7 Entry: 7
Data: 46|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor Data: 46|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField - Name: <Name>k__BackingField
Entry: 1 Entry: 1
Data: kinematic Data: dead
- Name: <UserType>k__BackingField - Name: <UserType>k__BackingField
Entry: 9 Entry: 9
Data: 42 Data: 44
- Name: <SystemType>k__BackingField - Name: <SystemType>k__BackingField
Entry: 9 Entry: 9
Data: 42 Data: 44
- Name: <SyncMode>k__BackingField - Name: <SyncMode>k__BackingField
Entry: 7 Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -901,19 +901,19 @@ MonoBehaviour:
Data: Data:
- Name: $k - Name: $k
Entry: 1 Entry: 1
Data: followingPredefinedPath Data: kinematic
- Name: $v - Name: $v
Entry: 7 Entry: 7
Data: 48|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor Data: 48|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField - Name: <Name>k__BackingField
Entry: 1 Entry: 1
Data: followingPredefinedPath Data: kinematic
- Name: <UserType>k__BackingField - Name: <UserType>k__BackingField
Entry: 9 Entry: 9
Data: 42 Data: 44
- Name: <SystemType>k__BackingField - Name: <SystemType>k__BackingField
Entry: 9 Entry: 9
Data: 42 Data: 44
- Name: <SyncMode>k__BackingField - Name: <SyncMode>k__BackingField
Entry: 7 Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -949,31 +949,19 @@ MonoBehaviour:
Data: Data:
- Name: $k - Name: $k
Entry: 1 Entry: 1
Data: predefinedPath Data: followingPredefinedPath
- Name: $v - Name: $v
Entry: 7 Entry: 7
Data: 50|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor Data: 50|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField - Name: <Name>k__BackingField
Entry: 1 Entry: 1
Data: predefinedPath Data: followingPredefinedPath
- Name: <UserType>k__BackingField - Name: <UserType>k__BackingField
Entry: 7 Entry: 9
Data: 51|System.RuntimeType, mscorlib Data: 44
- Name:
Entry: 1
Data: Marro.PacManUdon.Direction[], Assembly-CSharp
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField - Name: <SystemType>k__BackingField
Entry: 7 Entry: 9
Data: 52|System.RuntimeType, mscorlib Data: 44
- Name:
Entry: 1
Data: System.Int32[], mscorlib
- Name:
Entry: 8
Data:
- Name: <SyncMode>k__BackingField - Name: <SyncMode>k__BackingField
Entry: 7 Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -988,7 +976,7 @@ MonoBehaviour:
Data: false Data: false
- Name: _fieldAttributes - Name: _fieldAttributes
Entry: 7 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: - Name:
Entry: 12 Entry: 12
Data: 0 Data: 0
@@ -1009,19 +997,31 @@ MonoBehaviour:
Data: Data:
- Name: $k - Name: $k
Entry: 1 Entry: 1
Data: predefinedPathIndex Data: predefinedPath
- Name: $v - Name: $v
Entry: 7 Entry: 7
Data: 54|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor Data: 52|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField - Name: <Name>k__BackingField
Entry: 1 Entry: 1
Data: predefinedPathIndex Data: predefinedPath
- Name: <UserType>k__BackingField - Name: <UserType>k__BackingField
Entry: 9 Entry: 7
Data: 8 Data: 53|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: Marro.PacManUdon.Direction[], Assembly-CSharp
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField - Name: <SystemType>k__BackingField
Entry: 9 Entry: 7
Data: 8 Data: 54|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: System.Int32[], mscorlib
- Name:
Entry: 8
Data:
- Name: <SyncMode>k__BackingField - Name: <SyncMode>k__BackingField
Entry: 7 Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -1057,16 +1057,16 @@ MonoBehaviour:
Data: Data:
- Name: $k - Name: $k
Entry: 1 Entry: 1
Data: targetDirection Data: predefinedPathIndex
- Name: $v - Name: $v
Entry: 7 Entry: 7
Data: 56|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor Data: 56|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField - Name: <Name>k__BackingField
Entry: 1 Entry: 1
Data: targetDirection Data: predefinedPathIndex
- Name: <UserType>k__BackingField - Name: <UserType>k__BackingField
Entry: 9 Entry: 9
Data: 7 Data: 8
- Name: <SystemType>k__BackingField - Name: <SystemType>k__BackingField
Entry: 9 Entry: 9
Data: 8 Data: 8
@@ -1114,10 +1114,10 @@ MonoBehaviour:
Data: freezeSeconds Data: freezeSeconds
- Name: <UserType>k__BackingField - Name: <UserType>k__BackingField
Entry: 9 Entry: 9
Data: 23 Data: 25
- Name: <SystemType>k__BackingField - Name: <SystemType>k__BackingField
Entry: 9 Entry: 9
Data: 23 Data: 25
- Name: <SyncMode>k__BackingField - Name: <SyncMode>k__BackingField
Entry: 7 Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -1162,10 +1162,10 @@ MonoBehaviour:
Data: frozen Data: frozen
- Name: <UserType>k__BackingField - Name: <UserType>k__BackingField
Entry: 9 Entry: 9
Data: 42 Data: 44
- Name: <SystemType>k__BackingField - Name: <SystemType>k__BackingField
Entry: 9 Entry: 9
Data: 42 Data: 44
- Name: <SyncMode>k__BackingField - Name: <SyncMode>k__BackingField
Entry: 7 Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib

View File

@@ -25,7 +25,6 @@ namespace Marro.PacManUdon
private Direction[] predefinedPath; private Direction[] predefinedPath;
private int predefinedPathIndex; private int predefinedPathIndex;
private Direction targetDirection;
private float freezeSeconds; private float freezeSeconds;
private bool frozen; 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 we're at a Vector2.zero, we skip applying the direction and only increment.
if (nextValidDirectionIndex == predefinedPathIndex) if (nextValidDirectionIndex == predefinedPathIndex)
{ {
SetDirection(predefinedPath[nextValidDirectionIndex]); SetDirectionAndTargetDirection(predefinedPath[nextValidDirectionIndex]);
SetTargetDirection(predefinedPath[nextValidDirectionIndex]);
nextPosition = PositionToGrid(nextPosition) + directionVectors[(int)direction] * 0.01f; 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 // 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; renderer.enabled = visible;
} }
public void SetTargetDirection(Direction targetDirection)
{
this.targetDirection = targetDirection;
UpdateAnimator();
}
public override void CollectSyncedData(byte[] data, ref int index, NetworkEventType eventType) public override void CollectSyncedData(byte[] data, ref int index, NetworkEventType eventType)
{ {
if (eventType != NetworkEventType.PacManTurn) if (eventType != NetworkEventType.PacManTurn)

View File

@@ -100,7 +100,7 @@ namespace Marro.PacManUdon
for (int i = 0; i < ghosts.Length; i++) for (int i = 0; i < ghosts.Length; i++)
{ {
ghosts[i].SetPosition(attractScreenElements[17 + i].transform.localPosition); ghosts[i].SetPosition(attractScreenElements[17 + i].transform.localPosition);
ghosts[i].SetDirection(Direction.Left); ghosts[i].SetDirectionAndTargetDirection(Direction.Left);
ghosts[i].SetState(PacManGhostState.Normal); ghosts[i].SetState(PacManGhostState.Normal);
} }
break; break;
@@ -119,8 +119,7 @@ namespace Marro.PacManUdon
case 18: case 18:
// Turn PacMan around after eating power pellet // Turn PacMan around after eating power pellet
pacMan.SetDirection(Direction.Right); pacMan.SetDirectionAndTargetDirection(Direction.Right);
pacMan.SetTargetDirection(Direction.Right);
break; break;
case 19: case 19:

View File

@@ -26,14 +26,14 @@ namespace Marro.PacManUdon
pacMan.SetKinematic(true); pacMan.SetKinematic(true);
pacMan.SetActive(true); pacMan.SetActive(true);
pacMan.SetPosition(intermissionScreenElements[0].transform.localPosition); pacMan.SetPosition(intermissionScreenElements[0].transform.localPosition);
pacMan.SetDirection(Direction.Left); pacMan.SetDirectionAndTargetDirection(Direction.Left);
ghostManager.SetLevel(5); ghostManager.SetLevel(5);
ghostManager.SetKinematic(true); ghostManager.SetKinematic(true);
ghostManager.gameObject.SetActive(true); ghostManager.gameObject.SetActive(true);
blinky.SetElroy(2); blinky.SetElroy(2);
blinky.SetPosition(intermissionScreenElements[1].transform.localPosition); blinky.SetPosition(intermissionScreenElements[1].transform.localPosition);
blinky.SetDirection(Direction.Left); blinky.SetDirectionAndTargetDirection(Direction.Left);
blinky.SetState(PacManGhostState.Normal); blinky.SetState(PacManGhostState.Normal);
SetFrozen(false); SetFrozen(false);
@@ -53,7 +53,7 @@ namespace Marro.PacManUdon
break; break;
case 4: case 4:
// Pacman starts chasing ghosts // Pacman starts chasing ghosts
pacMan.SetDirection(Direction.Right); pacMan.SetDirectionAndTargetDirection(Direction.Right);
pacMan.BecomeBig(); pacMan.BecomeBig();
break; break;
case 5: case 5:

View File

@@ -34,14 +34,14 @@ namespace Marro.PacManUdon
pacMan.SetKinematic(true); pacMan.SetKinematic(true);
pacMan.SetActive(true); pacMan.SetActive(true);
pacMan.SetPosition(intermissionScreenElements[0].transform.localPosition); pacMan.SetPosition(intermissionScreenElements[0].transform.localPosition);
pacMan.SetDirection(Direction.Left); pacMan.SetDirectionAndTargetDirection(Direction.Left);
ghostManager.SetLevel(5); ghostManager.SetLevel(5);
ghostManager.SetKinematic(true); ghostManager.SetKinematic(true);
ghostManager.gameObject.SetActive(true); ghostManager.gameObject.SetActive(true);
blinky.SetElroy(2); blinky.SetElroy(2);
blinky.SetPosition(intermissionScreenElements[1].transform.localPosition); blinky.SetPosition(intermissionScreenElements[1].transform.localPosition);
blinky.SetDirection(Direction.Left); blinky.SetDirectionAndTargetDirection(Direction.Left);
blinky.SetState(PacManGhostState.Normal); blinky.SetState(PacManGhostState.Normal);
SetFrozen(false); SetFrozen(false);
@@ -65,16 +65,16 @@ namespace Marro.PacManUdon
case 8: case 8:
// Blinky sprite updates with broken cover // Blinky sprite updates with broken cover
blinky.SetSpecialLook(true); blinky.SetSpecialLook(true);
blinky.SetDirection(Direction.Up); blinky.SetDirectionAndTargetDirection(Direction.Up);
blinky.SetPosition(blinky.GetPosition() + new Vector2(-0.250f, 0f)); blinky.SetPosition(blinky.GetPosition() + new Vector2(-0.250f, 0f));
break; break;
case 9: case 9:
// Blinky looks at broken cover // Blinky looks at broken cover
blinky.SetDirection(Direction.Down); blinky.SetDirectionAndTargetDirection(Direction.Down);
break; break;
case 10: case 10:
// Cutscene starts to unload // Cutscene starts to unload
blinky.SetDirection(Direction.Zero); blinky.SetDirectionAndTargetDirection(Direction.Zero);
break; break;
case 11: case 11:
// End cutscene // End cutscene

View File

@@ -26,14 +26,14 @@ namespace Marro.PacManUdon
pacMan.SetKinematic(true); pacMan.SetKinematic(true);
pacMan.SetActive(true); pacMan.SetActive(true);
pacMan.SetPosition(intermissionScreenElements[0].transform.localPosition); pacMan.SetPosition(intermissionScreenElements[0].transform.localPosition);
pacMan.SetDirection(Direction.Left); pacMan.SetDirectionAndTargetDirection(Direction.Left);
ghostManager.SetLevel(5); ghostManager.SetLevel(5);
ghostManager.SetKinematic(true); ghostManager.SetKinematic(true);
ghostManager.gameObject.SetActive(true); ghostManager.gameObject.SetActive(true);
blinky.SetElroy(2); blinky.SetElroy(2);
blinky.SetPosition(intermissionScreenElements[1].transform.localPosition); blinky.SetPosition(intermissionScreenElements[1].transform.localPosition);
blinky.SetDirection(Direction.Left); blinky.SetDirectionAndTargetDirection(Direction.Left);
blinky.SetState(PacManGhostState.Normal); blinky.SetState(PacManGhostState.Normal);
blinky.SetSpecialLook(true); blinky.SetSpecialLook(true);
@@ -45,13 +45,13 @@ namespace Marro.PacManUdon
break; break;
case 3: case 3:
// Reached end, freeze // Reached end, freeze
pacMan.SetDirection(Direction.Zero); pacMan.SetDirectionAndTargetDirection(Direction.Zero);
blinky.SetDirection(Direction.Zero); blinky.SetDirectionAndTargetDirection(Direction.Zero);
break; break;
case 4: case 4:
// Ghost runs back on screen // Ghost runs back on screen
blinky.SetPosition(intermissionScreenElements[3].transform.localPosition); blinky.SetPosition(intermissionScreenElements[3].transform.localPosition);
blinky.SetDirection(Direction.Right); blinky.SetDirectionAndTargetDirection(Direction.Right);
break; break;
case 5: case 5:
// End cutscene // End cutscene