batrix/scripts/gameplay/player/player_attack_effect.gd

29 lines
647 B
GDScript

extends MeshInstance3D
@export var _swoop_effect_time: float = 0.25
@export_group("References")
@export var _attack: PlayerAttacker
var _swoop_effect_timer: float
func _ready() -> void:
mesh.radius = _attack.attack_radius
mesh.height = _attack.attack_radius
_attack.attacked.connect(_on_attack_attacked)
func _process(delta: float) -> void:
if _swoop_effect_timer > 0:
_swoop_effect_timer -= delta
(material_override as StandardMaterial3D).albedo_color = Color(
1, 1, 1, _swoop_effect_timer / _swoop_effect_time
)
visible = _swoop_effect_timer > 0
func _on_attack_attacked() -> void:
_swoop_effect_timer = _swoop_effect_time