extends Node3D


var material: StandardMaterial3D

# Called when the node enters the scene tree for the first time.
func _ready() -> void:
	# Duplicate meshes and materials
	var star_bulb = $"Star Bulb"
	var star = $"Star Bulb/Star"
	
	star_bulb.mesh = star_bulb.mesh.duplicate()
	star.mesh = star.mesh.duplicate()
	
	var mat = star_bulb.mesh.surface_get_material(1)
	material = mat.duplicate()
	star_bulb.mesh.surface_set_material(1, material)
	star.mesh.surface_set_material(0, material)
	
	$AnimationPlayer.play("StarAction")


func _on_target_1_occupancy_changed(value: float) -> void:
	material.emission_energy_multiplier = value * 10
	$AnimationPlayer.speed_scale = value