Interface ISwitchTarget
Interface for objects that can be activated or deactivated by a Switch interactable. Implement on doors, chests, traps, or any scene object that responds to switch interactions.
public interface ISwitchTarget
Properties
IsActivated
Whether this target is currently in the activated state.
bool IsActivated { get; }
Property Value
Methods
Activate(IPlayerCharacter)
Activates this target (e.g., opens a door, unlocks a chest, disarms a trap).
void Activate(IPlayerCharacter activator)
Parameters
activatorIPlayerCharacterThe player character who triggered the switch.
Deactivate(IPlayerCharacter)
Deactivates this target (e.g., closes a door, locks a chest, re-arms a trap).
void Deactivate(IPlayerCharacter activator)
Parameters
activatorIPlayerCharacterThe player character who triggered the switch.
SnapTo(bool)
Puts this target into the given state with no transition.
void SnapTo(bool activated)
Parameters
activatedboolThe state to adopt immediately.
Remarks
For catching up rather than for reacting. A client that starts observing a switch reads the switch's current state out of its spawn payload, and that state describes something that happened before the player arrived — possibly hours before. Replaying it through Activate(IPlayerCharacter) would play the transition too, so walking into a room would set every door in it swinging. Nothing on the interaction path calls this.