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.
This commit is contained in:
Dan 2024-05-15 13:57:31 +01:00
parent 2a9e78b52e
commit f0a7c5ca05
12 changed files with 167 additions and 33 deletions

View file

@ -1,6 +1,6 @@
class_name DirectorDrone extends Drone
@onready var edit_cursor : Resource = preload("res://resources/cursors/message_dots_round.png")
@onready var label : Label = get_node("Label")
@export var visit_order : int = 0 :
@ -17,21 +17,19 @@ func _on_click_detection_mouse_entered() -> void:
if GameState.placing_drone == false:
Log.pr("Mouse entered the director drone!")
label.visible = true
Input.set_custom_mouse_cursor(edit_cursor, Input.CURSOR_ARROW, Vector2(32, 32))
CursorMgr.edit()
func _on_click_detection_mouse_exited() -> void:
if GameState.placing_drone == false:
Log.pr("Mouse exited the director drone!")
label.visible = false
#Input.set_custom_mouse_cursor(null)
GameState.reset_cursor()
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):
#Input.set_custom_mouse_cursor(null)
GameState.reset_cursor()
CursorMgr.reset_cursor()
queue_free()
get_parent().get_parent().update_director_drone_list()