using System; using System.Collections.Generic; using UnityEngine; public class WFAnimationConnect : MonoBehaviour { public void Awake() { if (this.ConnectObj != null && 0 < this.ConnectObj.Count) { for (int i = 0; i < this.ConnectObj.Count; i++) { this.SetAllEnabled(this.ConnectObj[i].gameObject, false); } } } public void OnEnable() { if (this.ConnectObj != null && 0 < this.ConnectObj.Count) { for (int i = 0; i < this.ConnectObj.Count; i++) { this.SetAllEnabled(this.ConnectObj[i].gameObject, false); } } } public void OnFinishAnime() { if (this.ConnectObj != null && 0 < this.ConnectObj.Count) { for (int i = 0; i < this.ConnectObj.Count; i++) { this.ConnectObj[i].gameObject.SetActive(true); } } } private void SetAllEnabled(GameObject obj, bool enabled) { if (obj != null) { obj.SetActive(enabled); WFAnimationConnect component = obj.GetComponent(); if (component != null && 0 < component.ConnectObj.Count) { for (int i = 0; i < component.ConnectObj.Count; i++) { this.SetAllEnabled(component.ConnectObj[i].gameObject, enabled); } } } } public List ConnectObj; }