otherworldly_simulation/scene/test/action_eat.gd

13 lines
313 B
GDScript3
Raw Permalink Normal View History

2024-10-25 15:41:39 +08:00
extends ActionLeaf
func tick(actor:Node,black_board:Blackboard):
var unit:Unit=actor
if black_board.has_value("target"):
var target=black_board.get_value("target")
if target is Food and unit.is_unit_instance_in_touch_area(target) :
unit.eat(target)
return SUCCESS
return FAILURE
return FAILURE