Table of Contents

Class ModularSwitch

Namespace
S1API.Misc
Assembly
S1API.dll

Wrapper for ScheduleOne ModularSwitch component. Provides a clean API without exposing game types directly.

public sealed class ModularSwitch
Inheritance
ModularSwitch
Inherited Members
Extension Methods

Constructors

ModularSwitch(GameObject)

Creates a new wrapper from a GameObject containing a ModularSwitch component.

public ModularSwitch(GameObject gameObject)

Parameters

gameObject GameObject

GameObject containing a ModularSwitch component.

Properties

IsOn

Gets or sets whether the switch is currently on.

public bool IsOn { get; set; }

Property Value

bool

Methods

SetInteractionMessages(string, string)

Updates the interaction message based on current switch state.

public void SetInteractionMessages(string messageWhenOn, string messageWhenOff)

Parameters

messageWhenOn string

Message to display when switch is On (e.g. "Lock Doors").

messageWhenOff string

Message to display when switch is Off (e.g. "Unlock Doors").

SwitchOff()

Turns the switch off programmatically.

public void SwitchOff()

SwitchOn()

Turns the switch on programmatically.

public void SwitchOn()

Events

OnSwitchedOff

Event fired when the switch is turned off.

public event Action? OnSwitchedOff

Event Type

Action

OnSwitchedOn

Event fired when the switch is turned on.

public event Action? OnSwitchedOn

Event Type

Action

OnToggled

Event fired when the switch is toggled on or off.

public event Action<bool>? OnToggled

Event Type

Action<bool>