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

@ -13,7 +13,6 @@ var director_drones : Array = [] # List of all director drones in the world
@onready var drone_controls : HBoxContainer = %DroneControls
@onready var ui_controls : UIComponent = get_parent().get_node("UiComponent")
@onready var spawned_drones_container : Node = get_node("SpawnedDrones")
@onready var place_cursor : Resource = preload("res://resources/cursors/target_round_b.png")
# Drones!
@onready var director_drone : Resource = preload("res://entities/DirectorDrone.tscn")
@ -83,7 +82,7 @@ func spawn_drone(drone_type : String) -> void:
func place_drone(drone_type : String) -> void:
if !spawning_drone:
Input.set_custom_mouse_cursor(place_cursor, Input.CURSOR_ARROW, Vector2(32, 32))
CursorMgr.place()
drone_controls.disable_buttons()
Log.pr("Placing " + drone_type + "...")
spawning_drone = true
@ -91,8 +90,7 @@ func place_drone(drone_type : String) -> void:
spawning_type = drone_type
func cancel_spawning() -> void:
#Input.set_custom_mouse_cursor(null)
GameState.reset_cursor()
CursorMgr.reset_cursor()
drone_controls.reset_button_focus()
drone_controls.enable_buttons()
spawning_drone = false