SpielBackupAlt/scripts/Task.gd

59 lines
1.0 KiB
GDScript
Executable File

extends Spatial
export var hour : int = 0
export var minute : int = 0
export var taskInteraction : NodePath
export var taskTime = 0
var time
var interaction = null
export var shouldNavigate = true
export var changeAggression = false
export var aggression = false
export var changeInvestigation = false
export var shouldInvestigate = false
var next = -1
func _ready():
if not taskInteraction.is_empty():
interaction = get_node(taskInteraction)
time = taskTime
func should_align():
return false
func done():
if get_child_count() > 0 and next < get_child_count()-1:
next += 1
return false
return true
func get_interaction():
if next < 0:
return interaction
else:
return get_child(next).interaction
func get_transform():
if next < 0:
return global_transform
else:
return get_child(next).global_transform
func waiting():
if next < 0:
time -= get_process_delta_time()
if time <= 0.0:
time = taskTime
return false
return true
else:
return get_child(next).waiting()