initial shit
This commit is contained in:
26
Objects/Scripts/ILed.gd
Normal file
26
Objects/Scripts/ILed.gd
Normal file
@@ -0,0 +1,26 @@
|
||||
extends Node3D
|
||||
|
||||
var LampMaterial = StandardMaterial3D.new();
|
||||
@export var isLampOn = false;
|
||||
@export_category("Lamp Config")
|
||||
@export var onColor : Color;
|
||||
@export var glowMultiplier : int;
|
||||
|
||||
func _ready() -> void:
|
||||
$Light.material_override = LampMaterial;
|
||||
|
||||
func startGlowing():
|
||||
LampMaterial.emission_enabled = true;
|
||||
LampMaterial.emission = onColor;
|
||||
LampMaterial.emission_energy_multiplier = glowMultiplier
|
||||
|
||||
func stopGlowing():
|
||||
LampMaterial.emission_energy_multiplier = 0.0;
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
if isLampOn:
|
||||
LampMaterial.albedo_color = onColor;
|
||||
startGlowing();
|
||||
else:
|
||||
LampMaterial.albedo_color = Color(0.069, 0.069, 0.069, 1.0);
|
||||
stopGlowing();
|
||||
Reference in New Issue
Block a user