protected virtual void OnDisable() { if (OnDisabled != null) { OnDisabled.Invoke(); } }
private void OnDisable() { #if UNITY_EDITOR EditorApplication.update -= EditorAppUpdateCallback; SceneView.onSceneGUIDelegate -= HandleOnSceneGUI; #endif OnDisabled?.Invoke(); #if UNITY_EDITOR && LOG_RELOAD_TIME Debug.Log("disabled" + EditorApplication.timeSinceStartup.ToString()); startReloadTime = EditorApplication.timeSinceStartup; #endif }
private void OnTriggerExit(Collider other) { WeightedObject o = other.GetComponent <WeightedObject>(); if (o == null) { return; } bool wasActivated = Activated; activeObjects.Remove(o.gameObject); RemoveObject(o); if (wasActivated != Activated) { OnDisabled.Invoke(); } }
/// <summary> /// Return an active pool member so that it can be used again later /// </summary> /// <param name="item">The reference to the item that is to be returned. This must be alive as currently marked by this pool</param> /// <returns>Returns true if the item was returned to the pool. Otherwise false</returns> /// <remarks> /// Using this functionality will modify the order of items in the pool from their original use order. /// This can effect functionality that is dependent on maintaining that order /// </remarks> public bool ReturnItem(T item) { // Find the index of the item in the pool int index = FindIndex(x => x == item); if (index == -1) { return(false); } // Swap it around with the last entry T temp = itemPool[AliveObjects - 1]; itemPool[AliveObjects - 1] = item; itemPool[index] = temp; --AliveObjects; // Disable the element as needed OnDisabled?.Invoke(item); return(true); }
/// <summary> /// Reset the items that are in the pool to a default state /// </summary> /// <param="_destroyItems">Flags if the pooled items should be destroyed instead<param> public void ResetPool(bool _destroyItems) { if (_destroyItems) { // Just destroy and clear the list for (int i = 0; i < itemPool.Count; ++i) { if (itemPool[i] != null) { if (i < AliveObjects) { OnDisabled?.Invoke(itemPool[i]); } OnDestroy?.Invoke(itemPool[i]); } } itemPool.Clear(); } else { // Disable the items for later re-use for (int i = itemPool.Count - 1; i >= 0; --i) { if (itemPool[i] != null) { if (i < AliveObjects) { OnDisabled?.Invoke(itemPool[i]); } } else { itemPool.RemoveAt(i); } } } // Nothing left active AliveObjects = 0; }
private void OnDisable() { OnDisabled.Invoke(); }
private void OnDisable() => OnDisabled?.Invoke();
/// <summary> /// Disables firewall. /// </summary> public virtual void Disable() { _mEnabled = false; OnDisabled?.Invoke(); }
public void Disable() { OnDisabled?.Invoke(this); gameObject.SetActive(false); }
private void OnDisable() { onDisabled?.Invoke(); }
public void Close() { gameObject.SetActive(false); callbackAction?.Invoke(); OnDisabled?.Invoke(this); }
public void PowerUpDisable(Motor motor) { OnDisabled?.Invoke(); Disable(motor); }