Cleaned up notes; restructured test scene plus cpu controller script; added WIP action stack logic
This commit is contained in:
@@ -1,21 +1,23 @@
|
||||
class_name StrategyStack extends Node
|
||||
|
||||
|
||||
|
||||
var active_action: ActionBase
|
||||
|
||||
|
||||
func _init() -> void:
|
||||
tree_entered.connect(add_action)
|
||||
tree_exited.connect(remove_action)
|
||||
child_entered_tree.connect( add_action.bind() )
|
||||
child_exiting_tree.connect( remove_action.bind() )
|
||||
|
||||
|
||||
func add_action() -> void:
|
||||
pass
|
||||
func add_action(action: ActionBase) -> void:
|
||||
if active_action: return
|
||||
active_action = action
|
||||
|
||||
func remove_action() -> void:
|
||||
pass
|
||||
func remove_action(action: ActionBase) -> void:
|
||||
if not active_action == action: return
|
||||
# NOTE: 1st node hasn't actually been removed yet
|
||||
active_action = null if not get_child_count() > 1 else get_child(1)
|
||||
|
||||
func process_action(jet: Jet) -> void:
|
||||
var action = get_child(0)
|
||||
if not action: return
|
||||
action.do(jet)
|
||||
if not active_action: return
|
||||
active_action.process(jet)
|
||||
|
||||
Reference in New Issue
Block a user