示例#1
0
    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);
        }
    }
示例#2
0
    /// <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);
    }