More use of Direction

This commit is contained in:
2026-06-15 10:58:16 +02:00
parent 73b3194c51
commit f1281280fa
6 changed files with 450 additions and 443 deletions

View File

@@ -1923,59 +1923,23 @@ MonoBehaviour:
Entry: 1
Data: predefinedPath
- Name: <UserType>k__BackingField
Entry: 9
Data: 11
- Name: <SystemType>k__BackingField
Entry: 9
Data: 11
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
Data: 98|System.RuntimeType, mscorlib
- Name:
Entry: 6
Data:
- Name:
Entry: 8
Data:
- Name: <IsSerialized>k__BackingField
Entry: 5
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 98|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: predefinedPathIndex
- Name: $v
Entry: 7
Data: 99|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: predefinedPathIndex
- Name: <UserType>k__BackingField
Entry: 9
Data: 8
Data: Marro.PacManUdon.Direction[], Assembly-CSharp
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 9
Data: 8
Entry: 7
Data: 99|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: System.Int32[], mscorlib
- Name:
Entry: 8
Data:
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -2012,13 +1976,13 @@ MonoBehaviour:
Data:
- Name: $k
Entry: 1
Data: <Index>k__BackingField
Data: predefinedPathIndex
- Name: $v
Entry: 7
Data: 101|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: <Index>k__BackingField
Data: predefinedPathIndex
- Name: <UserType>k__BackingField
Entry: 9
Data: 8
@@ -2061,31 +2025,68 @@ MonoBehaviour:
Data:
- Name: $k
Entry: 1
Data: cardinalDirections
Data: <Index>k__BackingField
- Name: $v
Entry: 7
Data: 103|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: <Index>k__BackingField
- Name: <UserType>k__BackingField
Entry: 9
Data: 8
- Name: <SystemType>k__BackingField
Entry: 9
Data: 8
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
- Name:
Entry: 6
Data:
- Name:
Entry: 8
Data:
- Name: <IsSerialized>k__BackingField
Entry: 5
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 104|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: cardinalDirections
- Name: $v
Entry: 7
Data: 105|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: cardinalDirections
- Name: <UserType>k__BackingField
Entry: 7
Data: 104|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: Marro.PacManUdon.Direction[], Assembly-CSharp
- Name:
Entry: 8
Data:
Entry: 9
Data: 98
- Name: <SystemType>k__BackingField
Entry: 7
Data: 105|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: System.Int32[], mscorlib
- Name:
Entry: 8
Data:
Entry: 9
Data: 99
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib

View File

@@ -83,7 +83,7 @@ namespace Marro.PacManUdon
private bool specialLook;
private bool followingPredefinedPath;
private Vector2[] predefinedPath;
private Direction[] predefinedPath;
private int predefinedPathIndex;
public bool IsScared => isScared;
@@ -170,7 +170,7 @@ namespace Marro.PacManUdon
private Vector2 ProcessNextPosition(Vector2 position, Vector2 nextPosition)
{
if (turnAroundSoon && ghostState == PacManGhostState.Normal
&& CrossesTileBorder(position, nextPosition, direction))
&& CrossesTileCenter(position, nextPosition, direction))
{
var newDirection = GetInverseDirection(direction);
Debug.Log($"{gameObject} turned around from direction {direction} to {newDirection}");
@@ -268,11 +268,11 @@ namespace Marro.PacManUdon
{
// Find the next valid direction which isn't Vector2.zero
int nextValidDirectionIndex = predefinedPathIndex;
while (predefinedPath[nextValidDirectionIndex] == Vector2.zero)
while (predefinedPath[nextValidDirectionIndex] == Direction.Zero)
{
nextValidDirectionIndex += 1;
}
if (!CheckCollisionInDirection(transform, nextPosition, predefinedPath[nextValidDirectionIndex]))
if (!pelletManager.IsWallUpcoming(nextPosition, directionVectors[(int)predefinedPath[nextValidDirectionIndex]]))
{
// If we're at a Vector2.zero, we skip applying the direction and only increment.
if (nextValidDirectionIndex == predefinedPathIndex)
@@ -289,7 +289,7 @@ namespace Marro.PacManUdon
followingPredefinedPath = false;
break;
}
} while (predefinedPath[nextValidDirectionIndex] == Vector2.zero);
} while (predefinedPath[nextValidDirectionIndex] == Direction.Zero);
}
// ghostManager.gameStateManager.statusDisplay.SetDebugText(1, predefinedPathIndex.ToString());
@@ -735,7 +735,7 @@ namespace Marro.PacManUdon
this.kinematic = kinematic;
}
public void SetPredefinedPath(Vector2[] predefinedPath)
public void SetPredefinedPath(Direction[] predefinedPath)
{
this.predefinedPath = predefinedPath;
followingPredefinedPath = true;

View File

@@ -957,59 +957,23 @@ MonoBehaviour:
Entry: 1
Data: predefinedPath
- Name: <UserType>k__BackingField
Entry: 9
Data: 11
- Name: <SystemType>k__BackingField
Entry: 9
Data: 11
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
Data: 51|System.RuntimeType, mscorlib
- Name:
Entry: 6
Data:
- Name:
Entry: 8
Data:
- Name: <IsSerialized>k__BackingField
Entry: 5
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 51|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: predefinedPathIndex
- Name: $v
Entry: 7
Data: 52|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: predefinedPathIndex
- Name: <UserType>k__BackingField
Entry: 9
Data: 8
Data: Marro.PacManUdon.Direction[], Assembly-CSharp
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 9
Data: 8
Entry: 7
Data: 52|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: System.Int32[], mscorlib
- Name:
Entry: 8
Data:
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -1045,25 +1009,67 @@ MonoBehaviour:
Data:
- Name: $k
Entry: 1
Data: targetDirection
Data: predefinedPathIndex
- Name: $v
Entry: 7
Data: 54|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: predefinedPathIndex
- Name: <UserType>k__BackingField
Entry: 9
Data: 8
- Name: <SystemType>k__BackingField
Entry: 9
Data: 8
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
- Name:
Entry: 6
Data:
- Name:
Entry: 8
Data:
- Name: <IsSerialized>k__BackingField
Entry: 5
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 55|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: targetDirection
- Name: $v
Entry: 7
Data: 56|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: targetDirection
- Name: <UserType>k__BackingField
Entry: 7
Data: 55|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: UnityEngine.Vector2, UnityEngine.CoreModule
- Name:
Entry: 8
Data:
Entry: 9
Data: 7
- Name: <SystemType>k__BackingField
Entry: 9
Data: 55
Data: 8
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -1078,7 +1084,7 @@ MonoBehaviour:
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 56|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
Data: 57|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 0
@@ -1102,7 +1108,7 @@ MonoBehaviour:
Data: freezeSeconds
- Name: $v
Entry: 7
Data: 57|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
Data: 58|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: freezeSeconds
@@ -1126,7 +1132,7 @@ MonoBehaviour:
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 58|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
Data: 59|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 0
@@ -1150,7 +1156,7 @@ MonoBehaviour:
Data: frozen
- Name: $v
Entry: 7
Data: 59|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
Data: 60|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: frozen
@@ -1174,7 +1180,7 @@ MonoBehaviour:
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 60|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
Data: 61|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 0

View File

@@ -22,10 +22,10 @@ namespace Marro.PacManUdon
private bool kinematic;
private bool followingPredefinedPath;
private Vector2[] predefinedPath;
private Direction[] predefinedPath;
private int predefinedPathIndex;
private Vector2 targetDirection;
private Direction targetDirection;
private float freezeSeconds;
private bool frozen;
@@ -35,8 +35,8 @@ namespace Marro.PacManUdon
private const float AnimatorDirectionNone = 0f;
private const float AnimatorDirectionRight = 0.25f;
private const float AnimatorDirectionLeft = 0.50f;
private const float AnimatorDirectionUp = 0.75f;
private const float AnimatorDirectionDown = 1f;
private const float AnimatorDirectionDown = 0.75f;
private const float AnimatorDirectionUp = 1f;
private const float AnimatorDirectionRightBig = 1.25f;
#endregion
@@ -60,7 +60,7 @@ namespace Marro.PacManUdon
{
transform.SetLocalPositionAndRotation(startPosition, startRotation);
direction = Direction.Left;
targetDirection = Vector2.left;
targetDirection = Direction.Left;
speed = defaultSpeed;
kinematic = false;
followingPredefinedPath = false;
@@ -126,7 +126,7 @@ namespace Marro.PacManUdon
private Vector2 ProcessNextPosition(Vector2 position, Vector2 nextPosition)
{
if (CrossesTileCenter(position, nextPosition, Direction.Left) // If pacman is moving horizontally, check if he may cross the center of a tile in that axis
&& (targetDirection.x == 0 || pelletManager.IsWallUpcoming(nextPosition, directionVectors[(int)HorizontalComponent(direction)])))
&& (!IsHorizontal(targetDirection) || pelletManager.IsWallUpcoming(nextPosition, directionVectors[(int)HorizontalComponent(direction)])))
{ // If the target direction is in the other axis or if we're about to run into a wall
nextPosition.x = PositionToGrid(nextPosition).x; // Snap pacman to the center of his current tile in this axis
SetDirection(VerticalComponent(direction));
@@ -134,7 +134,7 @@ namespace Marro.PacManUdon
}
if (CrossesTileCenter(position, nextPosition, Direction.Down) // See comments above but now vertical
&& (targetDirection.y == 0 || pelletManager.IsWallUpcoming(nextPosition, directionVectors[(int)VerticalComponent(direction)])))
&& (!IsVertical(targetDirection) || pelletManager.IsWallUpcoming(nextPosition, directionVectors[(int)VerticalComponent(direction)])))
{
nextPosition.y = PositionToGrid(nextPosition).y;
SetDirection(HorizontalComponent(direction));
@@ -155,7 +155,7 @@ namespace Marro.PacManUdon
{
SetDirection(inputDirection + new Vector2(PositionToGrid(nextPosition).x - nextPosition.x, 0).normalized);
}
SetTargetDirection(inputDirection); // This is the direction most logic should assume pacman is moving, the actual direction may be different due to cornering
SetTargetDirection(VectorToDirection(inputDirection)); // This is the direction most logic should assume pacman is moving, the actual direction may be different due to cornering
if (!followingPredefinedPath)
{
@@ -172,11 +172,11 @@ namespace Marro.PacManUdon
{
// Find the next valid direction which isn't Vector2.zero
int nextValidDirectionIndex = predefinedPathIndex;
while (predefinedPath[nextValidDirectionIndex] == Vector2.zero)
while (predefinedPath[nextValidDirectionIndex] == Direction.Zero)
{
nextValidDirectionIndex += 1;
}
if (!CheckCollisionInDirection(transform, nextPosition, predefinedPath[nextValidDirectionIndex]))
if (!CheckCollisionInDirection(transform, nextPosition, directionVectors[(int)predefinedPath[nextValidDirectionIndex]]))
{
// If we're at a Vector2.zero, we skip applying the direction and only increment.
if (nextValidDirectionIndex == predefinedPathIndex)
@@ -194,7 +194,7 @@ namespace Marro.PacManUdon
followingPredefinedPath = false;
break;
}
} while (predefinedPath[nextValidDirectionIndex] == Vector2.zero);
} while (predefinedPath[nextValidDirectionIndex] == Direction.Zero);
}
// gameStateManager.statusDisplay.SetDebugText(1, predefinedPathIndex.ToString());
@@ -226,22 +226,22 @@ namespace Marro.PacManUdon
else
{
animator.speed = 1;
if (targetDirection.Equals(Vector2.right))
if (targetDirection.Equals(Direction.Right))
{
animator.SetFloat(AnimatorKeyDirection, AnimatorDirectionRight);
}
else if (targetDirection.Equals(Vector2.left))
else if (targetDirection.Equals(Direction.Left))
{
animator.SetFloat(AnimatorKeyDirection, AnimatorDirectionLeft);
}
else if (targetDirection.Equals(Vector2.up))
{
animator.SetFloat(AnimatorKeyDirection, AnimatorDirectionUp);
}
else if (targetDirection.Equals(Vector2.down))
else if (targetDirection.Equals(Direction.Down))
{
animator.SetFloat(AnimatorKeyDirection, AnimatorDirectionDown);
}
else if (targetDirection.Equals(Direction.Up))
{
animator.SetFloat(AnimatorKeyDirection, AnimatorDirectionUp);
}
}
}
@@ -297,7 +297,7 @@ namespace Marro.PacManUdon
this.kinematic = kinematic;
}
public void SetPredefinedPath(Vector2[] predefinedPath)
public void SetPredefinedPath(Direction[] predefinedPath)
{
this.predefinedPath = predefinedPath;
followingPredefinedPath = true;
@@ -314,7 +314,7 @@ namespace Marro.PacManUdon
renderer.enabled = visible;
}
public void SetTargetDirection(Vector2 targetDirection)
public void SetTargetDirection(Direction targetDirection)
{
this.targetDirection = targetDirection;
UpdateAnimator();
@@ -352,12 +352,12 @@ namespace Marro.PacManUdon
if (kinematic || frozen || !enabled)
{
index += 8;
index += 1;
base.PadSyncedData(data, ref index, eventType);
return;
}
data.Append(targetDirection, ref index);
data.AppendAsByte((int)targetDirection, ref index);
base.CollectSyncedData(data, ref index, eventType);
}
@@ -371,12 +371,12 @@ namespace Marro.PacManUdon
if (kinematic || frozen || !enabled)
{
index += 8;
index += 1;
base.ConsumeSyncedData(data, ref index, eventType);
return true;
}
SetTargetDirection(data.ReadVector2(ref index));
SetTargetDirection((Direction)data.ReadByte(ref index));
return base.WriteSyncedData(data, ref index, eventType);
}

View File

@@ -20,304 +20,304 @@ namespace Marro.PacManUdon
break;
case 2:
// Setup ghosts
ghostManager.Ghosts[0].SetPredefinedPath(new Vector2[]{ // Blinky
Vector2.down,
Vector2.left,
Vector2.up,
Vector2.right,
Vector2.zero,
Vector2.zero,
Vector2.up,
Vector2.right,
Vector2.down,
Vector2.zero,
Vector2.right,
Vector2.up,
Vector2.left,
Vector2.down,
Vector2.right,
Vector2.up,
Vector2.zero,
Vector2.left,
Vector2.down,
Vector2.zero,
Vector2.left,
Vector2.down,
Vector2.right,
ghostManager.Ghosts[0].SetPredefinedPath(new Direction[]{ // Blinky
Direction.Up,
Direction.Left,
Direction.Down,
Direction.Right,
Direction.Zero,
Direction.Zero,
Direction.Down,
Direction.Right,
Direction.Up,
Direction.Zero,
Direction.Right,
Direction.Down,
Direction.Left,
Direction.Up,
Direction.Right,
Direction.Down,
Direction.Zero,
Direction.Left,
Direction.Up,
Direction.Zero,
Direction.Left,
Direction.Up,
Direction.Right,
// Goes through tunnel
Vector2.zero,
Vector2.up,
Vector2.left,
Vector2.down,
Vector2.right,
Vector2.down,
Vector2.right,
Vector2.down,
Vector2.right,
Vector2.up,
Vector2.right,
Vector2.up,
Vector2.left,
Vector2.zero,
Vector2.down,
Vector2.left,
Vector2.zero,
Vector2.up,
Vector2.left,
Direction.Zero,
Direction.Down,
Direction.Left,
Direction.Up,
Direction.Right,
Direction.Up,
Direction.Right,
Direction.Up,
Direction.Right,
Direction.Down,
Direction.Right,
Direction.Down,
Direction.Left,
Direction.Zero,
Direction.Up,
Direction.Left,
Direction.Zero,
Direction.Down,
Direction.Left,
// Gets eaten
Vector2.zero,
Vector2.up,
Vector2.right,
Vector2.up,
Vector2.right,
Vector2.down,
Vector2.right,
Vector2.down,
Vector2.left,
Vector2.down,
Vector2.left,
Vector2.down,
Vector2.right,
Vector2.down,
Vector2.left,
Direction.Zero,
Direction.Down,
Direction.Right,
Direction.Down,
Direction.Right,
Direction.Up,
Direction.Right,
Direction.Up,
Direction.Left,
Direction.Up,
Direction.Left,
Direction.Up,
Direction.Right,
Direction.Up,
Direction.Left,
});
ghostManager.Ghosts[1].SetPredefinedPath(new Vector2[]{ // Pinky
Vector2.down,
Vector2.left,
Vector2.up,
Vector2.zero,
Vector2.zero,
Vector2.left,
Vector2.down,
Vector2.right,
ghostManager.Ghosts[1].SetPredefinedPath(new Direction[]{ // Pinky
Direction.Up,
Direction.Left,
Direction.Down,
Direction.Zero,
Direction.Zero,
Direction.Left,
Direction.Up,
Direction.Right,
// Pellet starts
Vector2.up,
Vector2.right,
Vector2.down,
Vector2.left,
Vector2.up,
Vector2.right,
Direction.Down,
Direction.Right,
Direction.Up,
Direction.Left,
Direction.Down,
Direction.Right,
// Pellet ends
Vector2.zero,
Vector2.down,
Direction.Zero,
Direction.Up,
// Pellet starts
Vector2.left,
Vector2.down,
Vector2.zero,
Vector2.left,
Direction.Left,
Direction.Up,
Direction.Zero,
Direction.Left,
// Caught
Vector2.up,
Vector2.right,
Vector2.zero,
Vector2.down,
Vector2.right,
Vector2.down,
Vector2.right,
Direction.Down,
Direction.Right,
Direction.Zero,
Direction.Up,
Direction.Right,
Direction.Up,
Direction.Right,
// Home
Vector2.down,
Vector2.left,
Vector2.up,
Vector2.right,
Vector2.down,
Vector2.zero,
Vector2.right,
Vector2.down,
Vector2.right,
Vector2.up,
Vector2.right,
Vector2.up,
Vector2.left,
Vector2.zero,
Vector2.down,
Vector2.left,
Direction.Up,
Direction.Left,
Direction.Down,
Direction.Right,
Direction.Up,
Direction.Zero,
Direction.Right,
Direction.Up,
Direction.Right,
Direction.Down,
Direction.Right,
Direction.Down,
Direction.Left,
Direction.Zero,
Direction.Up,
Direction.Left,
// Power pellet active
Vector2.up,
Vector2.right,
Vector2.up,
Vector2.left,
Vector2.up,
Vector2.left,
Vector2.down,
Vector2.right,
Vector2.down,
Vector2.left,
Vector2.down,
Vector2.right,
Vector2.down,
Vector2.left,
Vector2.up
Direction.Down,
Direction.Right,
Direction.Down,
Direction.Left,
Direction.Down,
Direction.Left,
Direction.Up,
Direction.Right,
Direction.Up,
Direction.Left,
Direction.Up,
Direction.Right,
Direction.Up,
Direction.Left,
Direction.Down
});
ghostManager.Ghosts[2].SetPredefinedPath(new Vector2[]{ // Inky
Vector2.up,
Vector2.right,
Vector2.up,
Vector2.left,
Vector2.zero,
Vector2.zero,
Vector2.down,
Vector2.right,
ghostManager.Ghosts[2].SetPredefinedPath(new Direction[]{ // Inky
Direction.Down,
Direction.Right,
Direction.Down,
Direction.Left,
Direction.Zero,
Direction.Zero,
Direction.Up,
Direction.Right,
// Pellet starts
Vector2.up,
Vector2.right,
Vector2.up,
Direction.Down,
Direction.Right,
Direction.Down,
// Caught
Vector2.right,
Vector2.down,
Vector2.right,
Vector2.down,
Vector2.left,
Vector2.down,
Vector2.left,
Vector2.down,
Vector2.left,
Vector2.up,
Vector2.left,
Vector2.down,
Vector2.right,
Vector2.down,
Vector2.right,
Vector2.zero,
Vector2.down,
Vector2.right,
Vector2.down,
Vector2.left,
Vector2.zero,
Vector2.zero,
Vector2.up,
Vector2.right,
Vector2.up,
Vector2.left,
Vector2.up,
Vector2.right,
Vector2.up,
Vector2.left,
Vector2.up,
Vector2.right,
Vector2.down,
Vector2.left,
Vector2.down,
Vector2.left,
Vector2.zero,
Vector2.up,
Vector2.left
Direction.Right,
Direction.Up,
Direction.Right,
Direction.Up,
Direction.Left,
Direction.Up,
Direction.Left,
Direction.Up,
Direction.Left,
Direction.Down,
Direction.Left,
Direction.Up,
Direction.Right,
Direction.Up,
Direction.Right,
Direction.Zero,
Direction.Up,
Direction.Right,
Direction.Up,
Direction.Left,
Direction.Zero,
Direction.Zero,
Direction.Down,
Direction.Right,
Direction.Down,
Direction.Left,
Direction.Down,
Direction.Right,
Direction.Down,
Direction.Left,
Direction.Down,
Direction.Right,
Direction.Up,
Direction.Left,
Direction.Up,
Direction.Left,
Direction.Zero,
Direction.Down,
Direction.Left
});
ghostManager.Ghosts[3].SetPredefinedPath(new Vector2[]{ // Clyde
Vector2.down,
Vector2.right,
Vector2.up,
Vector2.left,
Vector2.down,
Vector2.zero,
Vector2.left,
Vector2.zero,
Vector2.down,
Vector2.right,
Vector2.down,
Vector2.right,
Vector2.up,
Vector2.right,
Vector2.zero,
Vector2.down,
Vector2.left,
Vector2.down,
Vector2.left,
Vector2.zero,
Vector2.up,
Vector2.right,
Vector2.zero,
Vector2.up,
Vector2.left,
Vector2.down,
Vector2.right,
Vector2.up,
Vector2.left,
Vector2.up,
Vector2.right,
Vector2.down,
Vector2.left,
Vector2.down,
Vector2.left,
Vector2.zero,
Vector2.up,
Vector2.right
ghostManager.Ghosts[3].SetPredefinedPath(new Direction[]{ // Clyde
Direction.Up,
Direction.Right,
Direction.Down,
Direction.Left,
Direction.Up,
Direction.Zero,
Direction.Left,
Direction.Zero,
Direction.Up,
Direction.Right,
Direction.Up,
Direction.Right,
Direction.Down,
Direction.Right,
Direction.Zero,
Direction.Up,
Direction.Left,
Direction.Up,
Direction.Left,
Direction.Zero,
Direction.Down,
Direction.Right,
Direction.Zero,
Direction.Down,
Direction.Left,
Direction.Up,
Direction.Right,
Direction.Down,
Direction.Left,
Direction.Down,
Direction.Right,
Direction.Up,
Direction.Left,
Direction.Up,
Direction.Left,
Direction.Zero,
Direction.Down,
Direction.Right
});
pacMan.SetPredefinedPath(new Vector2[]{
Vector2.down,
Vector2.right,
Vector2.down,
Vector2.right,
Vector2.zero,
Vector2.up,
Vector2.left,
Vector2.up,
Vector2.right,
Vector2.up,
Vector2.left,
Vector2.zero,
Vector2.up,
Vector2.zero,
Vector2.left,
Vector2.down,
Vector2.left,
Vector2.up,
Vector2.zero,
Vector2.zero,
Vector2.left,
Vector2.down,
Vector2.right,
Vector2.zero,
Vector2.up,
Vector2.left,
Vector2.down,
Vector2.zero,
Vector2.left,
Vector2.up,
Vector2.right,
Vector2.zero,
Vector2.down,
Vector2.right,
Vector2.down,
Vector2.left,
Vector2.down,
Vector2.left,
Vector2.zero,
Vector2.down,
Vector2.zero,
Vector2.right,
Vector2.down,
Vector2.left,
Vector2.zero,
Vector2.zero,
Vector2.up,
Vector2.right,
Vector2.up,
Vector2.left,
Vector2.up,
Vector2.right,
Vector2.zero,
Vector2.down,
Vector2.right,
Vector2.up,
Vector2.right,
Vector2.zero,
Vector2.down,
Vector2.left,
Vector2.down,
Vector2.right,
Vector2.down,
Vector2.left,
Vector2.zero,
Vector2.zero,
Vector2.up,
Vector2.right,
Vector2.up,
Vector2.left,
Vector2.up,
Vector2.right,
pacMan.SetPredefinedPath(new Direction[]{
Direction.Up,
Direction.Right,
Direction.Up,
Direction.Right,
Direction.Zero,
Direction.Down,
Direction.Left,
Direction.Down,
Direction.Right,
Direction.Down,
Direction.Left,
Direction.Zero,
Direction.Down,
Direction.Zero,
Direction.Left,
Direction.Up,
Direction.Left,
Direction.Down,
Direction.Zero,
Direction.Zero,
Direction.Left,
Direction.Up,
Direction.Right,
Direction.Zero,
Direction.Down,
Direction.Left,
Direction.Up,
Direction.Zero,
Direction.Left,
Direction.Down,
Direction.Right,
Direction.Zero,
Direction.Up,
Direction.Right,
Direction.Up,
Direction.Left,
Direction.Up,
Direction.Left,
Direction.Zero,
Direction.Up,
Direction.Zero,
Direction.Right,
Direction.Up,
Direction.Left,
Direction.Zero,
Direction.Zero,
Direction.Down,
Direction.Right,
Direction.Down,
Direction.Left,
Direction.Down,
Direction.Right,
Direction.Zero,
Direction.Up,
Direction.Right,
Direction.Down,
Direction.Right,
Direction.Zero,
Direction.Up,
Direction.Left,
Direction.Up,
Direction.Right,
Direction.Up,
Direction.Left,
Direction.Zero,
Direction.Zero,
Direction.Down,
Direction.Right,
Direction.Down,
Direction.Left,
Direction.Down,
Direction.Right,
});
break;

View File

@@ -120,7 +120,7 @@ namespace Marro.PacManUdon
case 18:
// Turn PacMan around after eating power pellet
pacMan.SetDirection(Direction.Right);
pacMan.SetTargetDirection(Vector2.right);
pacMan.SetTargetDirection(Direction.Right);
break;
case 19: