Add muzak, muffled screams, virtua hand
This commit is contained in:
parent
acb10d18a4
commit
54067d2087
15 changed files with 198 additions and 29 deletions
25
scenes/virtua_hand.gd
Normal file
25
scenes/virtua_hand.gd
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
extends Sprite3D
|
||||
|
||||
const UP_DURATION := 0.1
|
||||
const HOLD_DURATION := 0.05
|
||||
const DOWN_DURATION := 0.18
|
||||
|
||||
var _rest_position: Vector3
|
||||
var _tween: Tween
|
||||
|
||||
@onready var _button: Node3D = get_parent().get_node("ElevatorButton")
|
||||
|
||||
func _ready() -> void:
|
||||
_rest_position = position
|
||||
EventBus.block_pressed.connect(_animate_press)
|
||||
|
||||
func _animate_press() -> void:
|
||||
if not is_instance_valid(_button):
|
||||
return
|
||||
if _tween and _tween.is_valid():
|
||||
_tween.kill()
|
||||
var press_pos := Vector3(_rest_position.x, _button.position.y, _rest_position.z)
|
||||
_tween = create_tween()
|
||||
_tween.tween_property(self, "position", press_pos, UP_DURATION).set_trans(Tween.TRANS_SINE).set_ease(Tween.EASE_OUT)
|
||||
_tween.tween_interval(HOLD_DURATION)
|
||||
_tween.tween_property(self, "position", _rest_position, DOWN_DURATION).set_trans(Tween.TRANS_SINE).set_ease(Tween.EASE_IN)
|
||||
Loading…
Add table
Add a link
Reference in a new issue