skullball/godot/maps/scripts/test.gd
2026-08-06 17:22:35 +03:00

28 lines
706 B
GDScript

extends Triggerable
@export var mesh: MeshInstance3D
func update_appearance(time: float) -> void:
var progress = clamp(time, 0.0, 1.0);
var new_color = Color.RED * (1.0 - progress) + Color.WHITE * progress
if mesh != null:
mesh.get_active_material(0).set("albedo_color", new_color)
func _activate_visual(player_id: int, time_since_activation: float) -> void:
update_appearance(time_since_activation)
func _deactivate_visual() -> void:
update_appearance(1.0)
func _on_activate() -> bool:
return false
func _process(delta: float) -> void:
if is_server_active():
if server_active_for() > 1.0:
deactivate()
if is_active():
update_appearance(active_for())
else:
update_appearance(1.0)