public void Activate(MeshSetElement element, Block activate) { this.Activate(element, activate, other => { if (other.Animator) { other.Animator.Stop(); } }); }
public void Activate(MeshSetElement element, Block activate, Block deactivate) { foreach (MeshSetElement other in this.Elements.Values) { if (other != element) { deactivate(other); other.Toggle(false); } } if (element != null) { element.Toggle(true); activate(element); ActiveElement = element; } }
private Dictionary <String, MeshSetElement> InitElements() { MeshSetElement element; element = null; Dictionary <String, MeshSetElement> elements; elements = new Dictionary <String, MeshSetElement>(); foreach (MeshAnimator animator in gameObject.GetComponentsInChildren <MeshAnimator>(true)) { MeshSetElement other; other = new MeshSetElement(this.GetKey(animator), animator); if (element == null && other.Animator.gameObject.activeSelf == true) { element = other; } else { if (other.Animator) { other.Animator.Stop(); } other.Toggle(false); } // try { elements.Add(other.Key, other); // } catch(Exception e) { // Debug.Log(e); // Debug.Log(other.Animator.GetPathInHierarchy()); // } } return(elements); }