// 1. Define the structure of our "Mood Switcher" // This is like a blueprint for the device. const MoodSwitcher := struct Light: LightComponent Button: ButtonDevice IsSpooky: bool = false // This is our "State Variable" // 2. The Main Function: What happens when the button is pressed? @init main() = // We wait for the button to be pressed. // This is an "Event" - like a trigger in UEFN. Button.PressedEvent.Subscribe(func(event): // Toggle our spooky state IsSpooky := !IsSpooky if (IsSpooky): // SETTING 1: Turn shadows darker (Gain) // Think of Gain as multiplying the darkness. Light.SetShadowGain(0.8) // SETTING 2: Tint shadows green (Offset) // Offset adds color to the shadow region. Light.SetShadowOffset(Color(0.2, 0.5, 0.2, 1.0)) // SETTING 3: Increase contrast (make edges sharper) Light.SetShadowContrast(1.2) Print("Spooky Mode Activated!") else: # Reset to normal Light.SetShadowGain(1.0) # Normal brightness Light.SetShadowOffset(Color(0.0, 0.0, 0.0, 1.0)) # No tint Light.SetShadowContrast(1.0) # Normal contrast Print("Normal Mode Restored!") )