public void UnregisterWidget(InteractiveWidget widget) { if (mInteractiveWidgets != null) { mInteractiveWidgets.Remove(widget); } }
public void RegisterWidget(InteractiveWidget widget) { CollectWidgets(); if (mInteractiveWidgets.Contains(widget)) { return; } mInteractiveWidgets.Add(widget); widget.SetState(mState); }
/// <summary> /// Loop through all InteractiveEffects on child elements and update their states /// </summary> protected void UpdateEffects() { CollectWidgets(); CompareStates(); int interactiveCount = mInteractiveWidgets.Count; for (int i = 0; i < interactiveCount; ++i) { InteractiveWidget widget = mInteractiveWidgets[i]; widget.SetState(mState); int currentCount = mInteractiveWidgets.Count; if (currentCount < interactiveCount) { Debug.LogWarningFormat("Call to {0}'s SetState removed other interactive widgets. GameObject name: {1}.", widget.GetType(), widget.name); interactiveCount = currentCount; } } }