proto3 initial commit

This commit is contained in:
Segey Lapin
2020-04-13 12:45:25 +03:00
parent 69410badf6
commit 1084b6d5c3
1588 changed files with 368852 additions and 23 deletions

View File

@@ -0,0 +1,66 @@
extends Node
class_name BTBase
func _execute(tick: Tick) -> int:
_enter(tick)
if not tick.blackboard.get('isOpen', tick.tree, self):
_open(tick)
var status := _tick(tick)
if status != ERR_BUSY:
_close(tick)
_exit(tick)
return status
func _enter(tick: Tick) -> void:
tick.enter_node(self) #debug call to be filled out in Tick object
enter(tick)
func _open(tick: Tick) -> void:
tick.open_node(self)
tick.blackboard.set('isOpen', true, tick.tree, self)
open(tick)
func _tick(tick: Tick) -> int:
tick.tick_node(self)
return tick(tick)
func _close(tick: Tick) -> void:
tick.close_node(self)
tick.blackboard.set('isOpen', false, tick.tree, self)
close(tick)
func _exit(tick: Tick) -> void:
tick.exit_node(self)
exit(tick)
# The following functions are to be overridden in extending nodes
func enter(_tick: Tick) -> void:
pass
func open(_tick: Tick) -> void:
pass
func tick(_tick: Tick) -> int:
return OK
func close(_tick: Tick) -> void:
pass
func exit(_tick: Tick) -> void:
pass