initial commit

This commit is contained in:
2026-06-09 23:53:19 -05:00
commit 625f1eb1f9
9 changed files with 128 additions and 0 deletions

View File

@@ -0,0 +1,34 @@
extends StaticBody3D
var baseColor : Color
var pressedColor : Color
@onready var Animator = $Animator
var pressed : bool = false
var ButtonMaterial : StandardMaterial3D = StandardMaterial3D.new()
func _initButton(BaseColor:Color,PressedColor:Color):
baseColor=BaseColor
pressedColor=PressedColor
ButtonMaterial.albedo_color = BaseColor
func _ready() -> void:
$MeshRoot.material_override = ButtonMaterial
ButtonMaterial.albedo_color = baseColor
Animator.get_animation("interact").loop_mode = Animation.LOOP_NONE
func press():
if !pressed:
$"..".buttonPressed.emit()
$"..".buttonUpdated.emit()
Animator.play("interact")
ButtonMaterial.albedo_color = pressedColor
pressed=true
func release():
if pressed:
$"..".buttonReleased.emit()
$"..".buttonUpdated.emit()
Animator.play_backwards("interact")
ButtonMaterial.albedo_color = baseColor
pressed=false

View File

@@ -0,0 +1 @@
uid://cbexo34ybb17a

View File

@@ -0,0 +1,13 @@
extends Node3D
signal buttonPressed
signal buttonReleased
signal buttonUpdated
@export_category("Visuals")
@export var baseColor : Color
@export var pressedColor : Color
func _ready() -> void:
$StaticBody3D._initButton(baseColor,pressedColor)
print(baseColor,pressedColor)

View File

@@ -0,0 +1 @@
uid://dwbx108724v25