Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
21 changes: 10 additions & 11 deletions Assets/Scripts/Enemy/EnemySpawner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,19 @@ public class EnemySpawner : MonoBehaviour
private HashSet<Vector2Int> blockedCells = new();

IEnumerator Start()
{
if (maze == null || enemyPrefab == null || player == null)
{
Debug.LogError("EnemySpawner not configured correctly");
yield break;
}

// WAIT until maze is fully generated
while (!maze.IsReady)
yield return null;
if (maze == null || enemyPrefab == null || player == null)
{
Debug.LogError("EnemySpawner not configured correctly");
yield break;
}

SpawnEnemies();
}
// WAIT until maze is fully generated
while (!maze.IsReady)
yield return null;

SpawnEnemies();
}

void SpawnEnemies()
{
Expand Down
20 changes: 9 additions & 11 deletions Assets/Scripts/MazeGenerator3D.cs
Original file line number Diff line number Diff line change
Expand Up @@ -164,16 +164,14 @@ public Vector3 GetRandomPathWorldPosition(float y = 1f)
Vector2Int cell = pathCells[Random.Range(0, pathCells.Count)];
return new Vector3(cell.x * cellSize, y, cell.y * cellSize);
}
public bool IsWall(Vector2Int cell)
{
if (grid == null)
return true;

if (cell.x < 0 || cell.y < 0 || cell.x >= width || cell.y >= height)
return true;

return grid[cell.x, cell.y];
}

public bool IsWall(Vector2Int cell)
{
if (grid == null)
return true;

}
if (cell.x < 0 || cell.y < 0 || cell.x >= width || cell.y >= height)
return true;
return grid[cell.x, cell.y];
}
}
2 changes: 1 addition & 1 deletion Assets/Scripts/Player/Bullet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ public class Bullet : MonoBehaviour
{
private void OnCollisionEnter(Collision collision)
{
if(collision.collider.TryGetComponent<EnemyHealth>(out var enemy))
if (collision.collider.TryGetComponent<EnemyHealth>(out var enemy))
{
enemy.TakeDamage(10); // Assuming a fixed damage value; adjust as needed
}
Expand Down