You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Undertaker-Simulator/scenes/hammering.gd

27 lines
900 B

extends Node3D
@onready var body_animaiton: AnimationPlayer = $"../../../CoffinSwitcher/CoffinOpenable/AnimatedBody/AnimationPlayer"
@onready var hammer_animation: AnimationPlayer = $AnimationPlayer
@onready var face: MeshInstance3D = $"../../../CoffinSwitcher/CoffinOpenable/AnimatedBody/Armature/Skeleton3D/BoneAttachment3D/Body_002"
var uv_base:Vector3 = Vector3(0.,.25,0.)
var uv_after_hit: Vector3 = Vector3(.5,0.,0.)
func _input(event: InputEvent) -> void:
if event.is_action_pressed("hammering"):
var tween = get_tree().create_tween()
hammer_animation.play("swing")
tween.tween_interval(0.3)
tween.tween_callback(body_animaiton.play.bind("Face Hit"))
tween.tween_callback(setuv.bind(uv_after_hit))
if event.is_action_pressed("ui_left"):
setuv(uv_base)
func setuv(value:Vector3):
var faceMat:BaseMaterial3D = face.get_active_material(0)
faceMat.uv1_offset = value