@tool
extends Node3D

enum Loop {
	RESET,
	BOB_TIP,
	BOB_TAIL,
}

const COLOR_PARAMETER := "albedo"

@export var loop_animation: Loop:
	set(value):
		if is_instance_valid(animation_player):
			animation_player.play(str(Loop.keys()[value]))
		loop_animation = value

@export var color := Color("#ff99ff99"):
	set(value):
		if is_instance_valid(cube):
			var shader: ShaderMaterial = cube.get_surface_override_material(0)
			shader.set_shader_parameter(COLOR_PARAMETER, value)
		color = value

@onready var cube: MeshInstance3D = %Cube
@onready var animation_player: AnimationPlayer = %AnimationPlayer


func _ready() -> void:
	loop_animation = loop_animation
	color = color
