generated from krampus/template-godot4
26 lines
635 B
GDScript
26 lines
635 B
GDScript
class_name GunkDust extends GPUParticles3D
|
|
|
|
@export var emit_scale := 0.1
|
|
|
|
var _last_clear_total := 0.0
|
|
var _emitting_this_frame := false
|
|
|
|
|
|
func _on_gunkable_clear_total_updated(clear_total: float) -> void:
|
|
var delta := maxf(clear_total - _last_clear_total, 0)
|
|
|
|
amount_ratio = clampf(delta * emit_scale, 0, 1)
|
|
if delta > 0:
|
|
_emitting_this_frame = true
|
|
|
|
_last_clear_total = clear_total
|
|
|
|
|
|
func _on_gunkable_painted_at_point(point: Vector3, normal: Vector3) -> void:
|
|
look_at_from_position(point, point + normal, global_basis.y)
|
|
|
|
|
|
func _process(_delta: float) -> void:
|
|
emitting = _emitting_this_frame
|
|
_emitting_this_frame = false
|