- Introduced a new JobComponent and JobQueue to manage jobs in the game. - Created two new jobs: DigJob and InfectJob with their respective scripts. - Updated CrystalGlowComponent, FreeCameraComponent, MushroomGlowComponent, WaterEffectComponent to improve logging messages. - Adjusted camera movement limits in FreeCameraGameCameraComponent for better control. - Added FiniteStateMachine class for managing states of entities. - Implemented GlowingIdle state as an example of using the state machine. - Included a utility function to fetch file paths by extension from a directory.
31 lines
No EOL
888 B
GDScript
31 lines
No EOL
888 B
GDScript
extends Node
|
|
class_name FileUtilitiesClass
|
|
|
|
func get_file_paths_by_extension(directoryPath: String, extension: String, recursive: bool = false) -> Array:
|
|
|
|
var dir : DirAccess = DirAccess.open(directoryPath)
|
|
|
|
if !dir:
|
|
printerr("Warning: could not open directory: ", directoryPath)
|
|
return []
|
|
|
|
if dir.list_dir_begin() != OK:
|
|
printerr("Warning: could not list contents of: ", directoryPath)
|
|
return []
|
|
|
|
var filePaths := []
|
|
var fileName := dir.get_next()
|
|
|
|
while fileName != "":
|
|
if dir.current_is_dir():
|
|
if recursive:
|
|
var dirPath : String = dir.get_current_dir() + "/" + fileName
|
|
filePaths += get_file_paths_by_extension(dirPath, extension, recursive)
|
|
else:
|
|
if fileName.get_extension() == extension:
|
|
var filePath : String = dir.get_current_dir() + "/" + fileName
|
|
filePaths.append(filePath)
|
|
|
|
fileName = dir.get_next()
|
|
|
|
return filePaths |