Audience actually hears joke now at the end

This commit is contained in:
Waldemar Tomme 2024-01-28 10:02:41 +01:00
parent 91630979ec
commit b5bc64a581
2 changed files with 14 additions and 7 deletions

View File

@ -44,14 +44,25 @@ func _on_joke_button_button_pressed(joke: Joke):
last_joke = joke last_joke = joke
stamina -= joke.required_stamina stamina -= joke.required_stamina
_disable_buttons() _disable_buttons()
_start_joke_for_audience()
$AnimationPlayer.play("talking") $AnimationPlayer.play("talking")
func _tell_joke_to_audience(joke: Joke): func _get_targeted_audience_members() -> Array[AudienceMember]:
var arr: Array[AudienceMember]
for body in transmitter_area.get_overlapping_bodies(): for body in transmitter_area.get_overlapping_bodies():
var person = body.find_parent("Person") var person = body.find_parent("Person")
if not (person is AudienceMember): if not (person is AudienceMember):
continue continue
person.on_joke(joke) arr.append(person)
return arr
func _start_joke_for_audience():
for person in _get_targeted_audience_members():
person.on_joke_start()
func _finish_joke_for_audience(joke: Joke):
for person in _get_targeted_audience_members():
person.on_joke_finish(joke)
func _on_stamina_empty(): func _on_stamina_empty():
get_node("../DisplayGUI").visible = false get_node("../DisplayGUI").visible = false
@ -75,7 +86,7 @@ func ouch():
$Sprite2D.texture = default_texture $Sprite2D.texture = default_texture
func _on_animation_player_animation_finished(anim_name): func _on_animation_player_animation_finished(anim_name):
_tell_joke_to_audience(last_joke) _finish_joke_for_audience(last_joke)
if stamina <= 0: if stamina <= 0:
_on_stamina_empty() _on_stamina_empty()
else: else:

View File

@ -149,10 +149,6 @@ func on_joke_finish(joke: Joke):
update_mood(mood_change) update_mood(mood_change)
last_joke_heard = joke.type last_joke_heard = joke.type
func on_joke(joke: Joke):
var mood_change = profile.joke_mood_mapping.get(joke.type, 0)
update_mood(mood_change)
func throw_bottle(): func throw_bottle():
mood += 2.0 mood += 2.0