Removed most old networking stuff
This commit is contained in:
@@ -19,7 +19,6 @@ namespace Marro.PacManUdon
|
||||
private Vector3 startScale;
|
||||
private Animator animator;
|
||||
new Renderer renderer;
|
||||
private VRCObjectPool pelletPool;
|
||||
private bool hideUntilUnfrozen;
|
||||
private bool dead;
|
||||
private bool kinematic;
|
||||
@@ -44,11 +43,10 @@ namespace Marro.PacManUdon
|
||||
#endregion
|
||||
|
||||
|
||||
public void Initialize(PlayerInput input, VRCObjectPool pelletPool, GameManager gameController)
|
||||
public void Initialize(PlayerInput input, GameManager gameController)
|
||||
{
|
||||
this.gameController = gameController;
|
||||
this.input = input;
|
||||
this.pelletPool = pelletPool;
|
||||
animator = GetComponent<Animator>();
|
||||
renderer = GetComponent<Renderer>();
|
||||
frozen = false;
|
||||
@@ -143,23 +141,20 @@ namespace Marro.PacManUdon
|
||||
// Debug.Log($"{gameObject} crossed Y tile center from {currentPosition} with targetDirection {targetDirection}, nextPosition is now {nextPosition} and direction is now {direction}");
|
||||
}
|
||||
|
||||
if (Networking.IsOwner(gameObject))
|
||||
{
|
||||
Vector2 inputDirection = input.GetDirection();
|
||||
if (!inputDirection.Equals(Vector2.zero) && !inputDirection.Equals(targetDirection) // Ignore neutral input or input in our current direction
|
||||
&& (inputDirection.x == 0 || (Math.Round(nextPosition.y, 5) - 0.5) % 1 != 0) && (inputDirection.y == 0 || (Math.Round(nextPosition.x, 5) - 0.5) % 1 != 0) // Target grid position near the edge of a tile may not be correct, ignore inputs near the border
|
||||
&& !GridMoverTools.CheckCollisionInDirection(transform, nextPosition, inputDirection))
|
||||
{ // Check if the requested direction does not have a wall
|
||||
if (inputDirection.x != 0)
|
||||
{ // Move in the requested direction, as well as perpundicular to it to get to the center of the tunnel
|
||||
SetDirection(inputDirection + new Vector2(0, GridMoverTools.PositionToGrid(nextPosition).y - nextPosition.y).normalized);
|
||||
}
|
||||
else
|
||||
{
|
||||
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
|
||||
Vector2 inputDirection = input.GetDirection();
|
||||
if (!inputDirection.Equals(Vector2.zero) && !inputDirection.Equals(targetDirection) // Ignore neutral input or input in our current direction
|
||||
&& (inputDirection.x == 0 || (Math.Round(nextPosition.y, 5) - 0.5) % 1 != 0) && (inputDirection.y == 0 || (Math.Round(nextPosition.x, 5) - 0.5) % 1 != 0) // Target grid position near the edge of a tile may not be correct, ignore inputs near the border
|
||||
&& !GridMoverTools.CheckCollisionInDirection(transform, nextPosition, inputDirection))
|
||||
{ // Check if the requested direction does not have a wall
|
||||
if (inputDirection.x != 0)
|
||||
{ // Move in the requested direction, as well as perpundicular to it to get to the center of the tunnel
|
||||
SetDirection(inputDirection + new Vector2(0, GridMoverTools.PositionToGrid(nextPosition).y - nextPosition.y).normalized);
|
||||
}
|
||||
else
|
||||
{
|
||||
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
|
||||
}
|
||||
|
||||
return nextPosition;
|
||||
@@ -324,15 +319,7 @@ namespace Marro.PacManUdon
|
||||
Pellet pellet = other.gameObject.GetComponent<Pellet>();
|
||||
if (pellet)
|
||||
{
|
||||
if (Networking.IsOwner(gameObject))
|
||||
{
|
||||
pelletPool.Return(pellet.gameObject);
|
||||
}
|
||||
else
|
||||
{
|
||||
pellet.pelletRenderer.enabled = false;
|
||||
pellet.gameObject.SetActive(false);
|
||||
}
|
||||
pellet.gameObject.SetActive(false);
|
||||
|
||||
if (pellet.isPowerPellet)
|
||||
{
|
||||
@@ -346,7 +333,7 @@ namespace Marro.PacManUdon
|
||||
}
|
||||
return;
|
||||
}
|
||||
else if (Networking.IsOwner(gameObject) && other.gameObject.GetComponent<BonusFruit>())
|
||||
else if (other.gameObject.GetComponent<BonusFruit>())
|
||||
{
|
||||
gameController.GotFruit();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user