36 lines
1.2 KiB
GDScript
36 lines
1.2 KiB
GDScript
extends Node3D
|
|
|
|
# Get a reference to the Bear_FX AnimationPlayer node
|
|
@onready var fx_player: AnimationPlayer = $Bear_FX/AnimationPlayer
|
|
|
|
# Preloads the material into memory before the scene even instantiates
|
|
@onready var claw_fx_material: StandardMaterial3D = preload("res://Materials/M_bear_claw_fx.tres")
|
|
|
|
func _ready() -> void:
|
|
# Apply it instantly to a mesh as soon as the level starts
|
|
$Bear_FX/Bear_fx_claw_attack_L.material_override = claw_fx_material
|
|
$Bear_FX/Bear_fx_claw_attack_R.material_override = claw_fx_material
|
|
|
|
|
|
func bear_fx_jump_smash():
|
|
$Bear_FX/Bear_fx_jump_smash.visible = true
|
|
fx_player.play("Bear_fx_jump_smash")
|
|
|
|
func bear_fx_claw_attack_R():
|
|
$Bear_FX/Bear_fx_claw_attack_R.visible = true
|
|
fx_player.play("Bear_fx_claw_attack_R")
|
|
|
|
func bear_fx_claw_attack_L():
|
|
$Bear_FX/Bear_fx_claw_attack_L.visible = true
|
|
fx_player.play("Bear_fx_claw_attack_L")
|
|
|
|
func bear_fx_smash_hit():
|
|
$Bear_FX/Bear_fx_smash_hit.visible = true
|
|
fx_player.play("Bear_fx_smash_hit")
|
|
|
|
func mesh_off():
|
|
$Bear_FX/Bear_fx_smash_hit.visible = false
|
|
$Bear_FX/Bear_fx_claw_attack_L.visible = false
|
|
$Bear_FX/Bear_fx_claw_attack_R.visible = false
|
|
$Bear_FX/Bear_fx_jump_smash.visible = false
|