private PathChunkArea GenerateAreaForLevelPathCell(LevelPathCell levelPathCell) { var area = new PathChunkArea(); area.HorizontalChunkCount = _rng.RandiRange(_minChunkWidth, _maxChunkWidth); area.VerticalChunkCount = _rng.RandiRange(_minChunkHeight, _maxChunkHeight); area.LevelPathCell = levelPathCell; return(area); }
private LevelPathCell GetNextPathPoint(HashSet <Vector2> occupied, LevelPathCell prevCell) { var directionChange = _rng.Randf(); var prevDirection = prevCell.Direction; var newDirection = prevDirection; if (directionChange < _pathDirectionChangePercent) { var directions = _fourDirections.OrderBy(x => _rng.Randf()); foreach (var dir in directions) { if (!occupied.Contains(prevCell.Position + dir)) { newDirection = dir; break; } } } return(new LevelPathCell(prevCell.Position + prevDirection, newDirection)); }