void findTCH() { if (_tch == null) { _tch = GetComponentInChildren <TallCharacterHelper>(); } }
public void Add_TallCharacterHelper() { if (PrefabHelper.IsPrefab(gameObject)) { Debug.LogError("Not available when Prefab."); return; } findTCH(); if (_tch != null) { Debug.Log("This already has a TCH."); return; } string err = null; if (IsoMap.IsNull) { err = "There is no IsoMap instance!"; } else if (IsoMap.instance.TchPrefab == null) { err = "There is no IsoMap.Instance.TCHPrefab!"; } else { _tch = Instantiate(IsoMap.instance.TchPrefab).GetComponent <TallCharacterHelper>(); if (_tch == null) { err = "There is no TallCharacterHelper component in the IsoMap.Instance.TCHPrefab!!"; } } if (err != null) { Debug.LogError(err); return; } _tch.transform.SetParent(transform); _tch.transform.localPosition = Vector3.zero; _tch.Init(); }