/// <summary> /// When set to false, also sets all z-values of mesh to zero. /// </summary> /// <param name="active"></param> public void SetActive(bool active) { IsActive = active; if (!active) { for (int i = 0; i < m_kinectDepthMesh.verts.Length; i++) { m_kinectDepthMesh.verts[i].z = 0; } m_kinectDepthMesh.Apply(); } OnActivationChanged?.Invoke(active); }
/** * <summary> * Determine, whether all observed switches are currently activated at once * </summary> * <param name="suppressCallbacks">Iff true, no subscribers of the `OnActivationChanged` event will be informed when the activation changes. Default: false</param> */ void ComputeActivation(bool suppressCallbacks = false) { var oldActivation = _activation; // If the <c>noDeactivation</c> property is set to true, we no longer change the activation if it has been set to // <c>true</c> once. Otherwise, we update the activation based on the values of the registered switches. if (!noDeactivation || !_hasBeenActivatedOnce) { _activation = _switchValues.All(v => v); _hasBeenActivatedOnce = _activation || _hasBeenActivatedOnce; } // If the activation state of this component changed, inform all subscribers if (!suppressCallbacks && oldActivation != _activation) { OnActivationChanged?.Invoke(_activation); } }