private static string TOGGLE_EVENT_IDENTIFIER = "lightswitch"; // Unique identifier for the light switch event private void Awake() { // Listen to interactions from light switch, setup initial light state if (LightSwitchInteractable) { LightSwitchInteractable.AddListenerToToggleEvent(ToggleLightSource, TOGGLE_EVENT_IDENTIFIER); } }
/// <summary> /// Helper method for subscribing to interactable toggle event. This enables toggling of the /// heat emitter on interaction with the attached interactable (via reaction). /// </summary> /// <returns>True if subscribed to interactable toggle event. False if otherwise.</returns> private bool SetupHeatEmitterToggling() { if (InteractableForTogglingState) { InteractableForTogglingState.AddListenerToToggleEvent(ToggleEmissions, TOGGLE_EVENT_IDENTIFIER); return(true); } Debug.LogError("No interactable attached with heat emitter: '" + gameObject.name + "'."); return(false); }