pollen-not-included/entities/scripts/director_drone.gd
Dan f0a7c5ca05 Added health bar and snail behavior enhancements
- Introduced a health bar for flowers, which updates based on the current GameState values.
- Enhanced snail behavior with eating and sleeping states. Snails now have a chance to switch to the sleeping state while eating.
- Improved mouse interaction with snails, allowing them to potentially switch to sleep mode when clicked.
- Refactored cursor management into its own class for better code organization and readability.
- Updated drone placement logic to use the new CursorManager class.
- Added functionality for bees to replenish flower nectar levels after a certain number of deposits.
2024-05-15 13:57:31 +01:00

35 lines
979 B
GDScript

class_name DirectorDrone extends Drone
@onready var label : Label = get_node("Label")
@export var visit_order : int = 0 :
get:
return visit_order
set(value):
visit_order = value
update_label_value()
func update_label_value() -> void:
$Label.text = str(visit_order)
func _on_click_detection_mouse_entered() -> void:
if GameState.placing_drone == false:
Log.pr("Mouse entered the director drone!")
label.visible = true
CursorMgr.edit()
func _on_click_detection_mouse_exited() -> void:
if GameState.placing_drone == false:
Log.pr("Mouse exited the director drone!")
label.visible = false
CursorMgr.reset_cursor()
func _on_click_detection_input_event(_viewport:Node, event:InputEvent, _shape_idx:int) -> void:
if GameState.placing_drone == false:
if (event is InputEventMouseButton && event.button_index == MOUSE_BUTTON_RIGHT && event.pressed):
CursorMgr.reset_cursor()
queue_free()
get_parent().get_parent().update_director_drone_list()