Ghost turn points baked
This commit is contained in:
@@ -18,7 +18,7 @@ namespace Marro.PacManUdon
|
||||
|
||||
byte[] syncedPelletsCollected;
|
||||
|
||||
int[] tilemap;
|
||||
int[] collisionMap;
|
||||
|
||||
const int mazeWidth = 28;
|
||||
const int mazeHeight = 31;
|
||||
@@ -84,23 +84,22 @@ namespace Marro.PacManUdon
|
||||
public bool IsWallUpcoming(Vector2 position, Vector2 directionVector)
|
||||
{
|
||||
var result = GetTileAt(position + directionVector) == (int)PacManTileType.Wall;
|
||||
Debug.Log($"Is wall upcoming {result} at position {position}, direction {directionVector}");
|
||||
return result;
|
||||
}
|
||||
|
||||
public bool[] GetBlockedDirections(Vector2 position)
|
||||
public int GetAvailableDirections(Vector2 position)
|
||||
{
|
||||
var results = new bool[4];
|
||||
var directions = GetTileAt(position);
|
||||
|
||||
results[0] = IsWallUpcoming(position, Vector2.down);
|
||||
results[1] = IsWallUpcoming(position, Vector2.up);
|
||||
results[2] = IsWallUpcoming(position, Vector2.left);
|
||||
results[3] = IsWallUpcoming(position, Vector2.right);
|
||||
if (directions <= 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
return results;
|
||||
return directions;
|
||||
}
|
||||
|
||||
private int GetTileAt(Vector2 position) => tilemap[GetTilemapIndex(position)];
|
||||
private int GetTileAt(Vector2 position) => collisionMap[GetTilemapIndex(position)];
|
||||
|
||||
private int GetTilemapIndex(Vector2 position)
|
||||
{
|
||||
@@ -133,7 +132,7 @@ namespace Marro.PacManUdon
|
||||
syncedPelletsCollected = new byte[pellets.Length/8 + 1];
|
||||
PelletCollectedCount = 0;
|
||||
|
||||
tilemap = PacManConstants.GetMazeDefinition();
|
||||
collisionMap = PacManConstants.GetMazeCollisionInfo();
|
||||
|
||||
return PelletCount;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user