Enhanced snail interaction and sleep behavior

The update includes improvements to the snail's interactive behavior. Now, when the mouse hovers over a snail that is eating, it changes to a hand cursor. This change enhances user feedback during interaction.

Additionally, the sleeping state of the snail has been expanded. The snail now wakes up after a random interval between 15 and 25 seconds. A timer tracks this duration and triggers a state transition to "Eating" once elapsed.

A new hand cursor resource was also added to the CursorManager for use in these interactions.
This commit is contained in:
Dan 2024-05-15 14:47:28 +01:00
parent f0a7c5ca05
commit 7d47bdbf5a
3 changed files with 23 additions and 5 deletions

View file

@ -3,14 +3,26 @@ class_name SnailSleeping
@onready var snail : Snail = get_parent().get_parent() as Snail # I think this is bad but I dont care it works
var wakes_up_in : float = 0
var sleep_timer : float = 0
func enter(_msg : Dictionary = {}) -> void:
Log.pr("I am a snail asleep...")
snail.rotation = 0
CursorMgr.reset_cursor()
# Decide how many seconds until the snail wakes up again
wakes_up_in = randf_range(15.0, 25.0)
sleep_timer = 0
func exit() -> void:
pass
func update(_delta : float) -> void:
pass
func update(delta : float) -> void:
sleep_timer += delta
if sleep_timer > wakes_up_in:
state_transition.emit(self, "Eating")
func physics_update(_delta : float) -> void:
pass