21 lines
392 B
GDScript
21 lines
392 B
GDScript
class_name Task
|
|
extends Node
|
|
|
|
enum {FAILURE = -1, SUCCESS = 1, RUNNING = 0}
|
|
var status: int = FAILURE
|
|
|
|
|
|
func run(p_blackboard: Dictionary) -> void:
|
|
pass
|
|
|
|
|
|
func cancel(p_blackboard: Dictionary):
|
|
pass
|
|
|
|
|
|
func get_first_child() -> Task:
|
|
if get_child_count() == 0:
|
|
push_error("Task does not have any children: " + name)
|
|
return null
|
|
return get_children()[0] as Task
|