SpaceClient/Scripts/Plan.gd

19 lines
504 B
GDScript

class_name Plan
const TURN_TIME : float = 5.0
var elements = [] # All elements of the plan thus far
var current_elements = [] # All elements of the next 5 seconds
func sanity_check() -> bool:
# Returns true if sane and false if insane
var total_time : float = 0.0
for current_element in current_elements:
var element : PlanElement = (current_element as PlanElement)
total_time += elemet.time
if !element.sanity_check():
return false
if total_time > TURN_TIME:
return false
return true