public static GetPlayingAnim Create(GameObject attachObj) { if (attachObj == null) { return(null); } if (attachObj.GetComponent <Animator>() == null) { Debug.LogErrorFormat("{0} 没有Animator组件!!!", attachObj.name); return(null); } GetPlayingAnim component = attachObj.GetComponent <GetPlayingAnim>() ?? attachObj.AddComponent <GetPlayingAnim>(); component.GetAllState(); return(component); }
public GetPlayingAnim DoInit() { var attachObj = this.gameObject; if (attachObj == null) { return(null); } if (attachObj.GetComponent <Animator>() == null) { Debug.LogErrorFormat("{0} 没有Animator组件!!!", attachObj.name); return(null); } GetPlayingAnim component = attachObj.GetComponent <GetPlayingAnim>() ?? attachObj.AddComponent <GetPlayingAnim>(); component.GetAllState(); return(component); }