Skip to content

Commit

Permalink
Close Issue #63 - Fix grabbing drink from fridge animation
Browse files Browse the repository at this point in the history
Adjust order of animations, now goes crouch and open doors, grab drink, uncrouch and close doors, turn around, drink
Rotated interact point to fix player direction
  • Loading branch information
666Savior committed Oct 17, 2021
1 parent 287871d commit 8f13af6
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 11 deletions.
1 change: 1 addition & 0 deletions level/Cafe.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ transform = Transform( -1.62921e-07, 0, -1, 0, 1, 0, 1, 0, -1.62921e-07, -0.125,

[node name="Fridge" parent="LevelInteractables" instance=ExtResource( 4 )]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -2.8, 0, -4.5 )
cold_beverage_scene = ExtResource( 12 )

[node name="ServingTray" parent="LevelInteractables" instance=ExtResource( 2 )]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -2.296, 1, 1.315 )
Expand Down
26 changes: 16 additions & 10 deletions level/Fridge.gd
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ class_name Fridge
extends Area

export var activity_cold_beverage: Resource
export var cold_beverage_scene: PackedScene

enum States {IDLE, WORKING}

Expand All @@ -12,11 +13,11 @@ var timeout: float = 0.0

onready var outline = find_node("Outline", true, false)
onready var tooltip: SpatialLabel = $Togglables/SpatialLabel
onready var cold_beverage = cold_beverage_scene.instance()

func _ready() -> void:
connect("mouse_entered", self, "hover")
connect("mouse_exited", self, "unhover")
pass

func hover() -> void:
var activity_intent = get_current_activity_intent()
Expand Down Expand Up @@ -64,8 +65,6 @@ func _process(delta: float) -> void:
if state == States.WORKING and is_timeout:
eprint("finished chilling at the fridge")
state = States.IDLE
var animation_player: AnimationPlayer = $"/root/Game".player_visual.get_node("baristaLowPoly/AnimationPlayer")
animation_player.play("uncrouch")
# TODO: make a "fridge closing" noise
return
pass
Expand All @@ -76,20 +75,27 @@ func set_using():
state = States.WORKING
var beverage_duration: float = activity_cold_beverage.duration
timeout = get_node(@"/root/Game").time_elapsed + beverage_duration
var animation_player: AnimationPlayer = $"/root/Game".player_visual.get_node("baristaLowPoly/AnimationPlayer")
open_fridge()
var animation_player: AnimationPlayer = $"/root/Game".player_visual.anim
$under_counter_fridge_exportPrep/AnimationPlayer.play("ArmatureAction")
animation_player.play("crouch")
if !HintPopup.firstfridgeuse:
HintPopup.firstfridgeuse = true
HintPopup.display("Consuming a cold refreshing beverage will help you keep your cool, and make the customers slightly more tolerable", 3.0)
yield(animation_player, "animation_finished")
var barista = $"/root/Game".player_visual
barista.carry_attachment.add_child(cold_beverage)
yield(get_tree().create_timer(0.25), "timeout")
$under_counter_fridge_exportPrep/AnimationPlayer.play_backwards("ArmatureAction")
animation_player.play("uncrouch")
yield(animation_player, "animation_finished")
var tween = barista.get_node("Tween")
tween.interpolate_property(barista, "rotation:y", barista.rotation.y, barista.rotation.y + (0.5 * TAU), 0.25)
tween.start()
yield(tween, "tween_completed")
animation_player.play("drinkBeverage")
yield(animation_player, "animation_finished")
barista.carry_attachment.remove_child(cold_beverage)

# TODO: convert this into speech baloons
func eprint(text: String):
print("FRIDGE: %s" % text)

func open_fridge():
$under_counter_fridge_exportPrep/AnimationPlayer.play("ArmatureAction")
yield($under_counter_fridge_exportPrep/AnimationPlayer, "animation_finished")
$under_counter_fridge_exportPrep/AnimationPlayer.play_backwards("ArmatureAction")
2 changes: 1 addition & 1 deletion level/Fridge.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ shape = SubResource( 2 )
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0 )

[node name="Position3D" type="Position3D" parent="ActivityLocations"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -1, 0.9 )
transform = Transform( -1, 0, -8.74228e-08, 0, 1, 0, 8.74228e-08, 0, -1, 0, -1, 0.9 )

[node name="Togglables" type="Spatial" parent="."]

Expand Down

0 comments on commit 8f13af6

Please sign in to comment.