void Clear() { for (int i = 0; i < transform.childCount; i++) { Destroy(transform.GetChild(i).gameObject); } m_getUI = null; // m_workUI = null; m_tipUI = null; showMoneyTip = null; }
void CreateBuild() { Clear(); string strPath = GetPrefabName(); UnityEngine.Object obj = PrefabLoader.loadFromPack(BASE_PREFAB_PATH + strPath, false); if (obj == null) { RED.LogWarning(BASE_PREFAB_PATH + strPath + "is not find"); return; } GameObject build = Instantiate(obj) as GameObject; build.name = strPath; RED.AddChild(build, this.gameObject); build.transform.localPosition = Vector3.zero; if (m_buildData != null) { this.name = m_buildData.config.ID + "_" + m_buildData.RTData.id.ToString(); } // if(m_buildData.config.build_kind == BaseBuildingData.BUILD_KIND_PRODUCE) // { // if(m_buildData.RTData.robc > 0) // { // UnityEngine.Object firePrefab = PrefabLoader.loadFromPack(BASE_PREFAB_PATH + FIRE, false); // m_fire = Instantiate(firePrefab) as GameObject; // RED.AddChild(m_fire, this.gameObject, new Vector3(0.4f, 1.6f, 0.1f)); // if (m_meat == null) // { // m_meat = transform.FindChild ("830001_1/Object171"); // } // if (m_meat != null) // { // RED.SetActive (false, m_meat.gameObject); // } // } // } UpdateRobFire(); CheckLighting(); if (m_buildData.config.build_kind != BaseBuildingData.BUILD_KIND_NORMAL) { m_getUI = transform.GetComponentInChildren <BuildGetUI>(); if (m_getUI != null) { m_getUI.InitUI(m_buildData, this); } else { RED.LogWarning("build get ui not find " + m_buildData.config.id); } } m_tipUI = transform.GetComponentInChildren <BuildTipUI>(); if (m_tipUI != null) { m_tipUI.InitName(m_buildData); } }