Pacman syncs really well now

This commit is contained in:
2026-01-16 20:36:21 +01:00
parent c41491e55e
commit 154c642cce
15 changed files with 1099 additions and 593 deletions

View File

@@ -1,7 +1,5 @@
using System;
using UnityEngine;
using VRC.SDK3.Components;
using VRC.SDKBase;
namespace Marro.PacManUdon
{
@@ -16,7 +14,6 @@ namespace Marro.PacManUdon
private float speed;
private Vector3 startPosition;
private Quaternion startRotation;
private Vector3 startScale;
private Animator animator;
new Renderer renderer;
private bool hideUntilUnfrozen;
@@ -53,13 +50,11 @@ namespace Marro.PacManUdon
hideUntilUnfrozen = false;
startPosition = startTransform.localPosition;
startRotation = startTransform.localRotation;
startScale = startTransform.localScale;
}
public void Reset()
{
transform.SetLocalPositionAndRotation(startPosition, startRotation);
transform.localScale = startScale;
direction = Vector2.left;
targetDirection = Vector2.left;
speed = defaultSpeed;
@@ -156,7 +151,7 @@ namespace Marro.PacManUdon
SetDirection(inputDirection + new Vector2(GridMoverTools.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
networkManager.SendEvent(NetworkEventType.PacManTurn);
networkManager.SendEventSoon(NetworkEventType.PacManTurn);
}
return nextPosition;