public void DeletePop() { FarmObjectPop componentInChildren = base.GetComponentInChildren <FarmObjectPop>(); if (null != componentInChildren) { componentInChildren.DestroyPop(); } }
public IEnumerator CreatePop(FarmObjectPop.PopType type, Transform cameraTransform, float adjustY) { GameObject resource = AssetDataMng.Instance().LoadObject("Farm/Builds/Pop/PopLocator", null, true) as GameObject; yield return(null); GameObject pop = UnityEngine.Object.Instantiate <GameObject>(resource); Transform t = pop.transform; Vector3 originalPos = t.localPosition; t.parent = base.transform; t.localPosition = originalPos; resource = null; Resources.UnloadUnusedAssets(); yield return(null); FarmObjectPop farmObjectPop = t.GetComponent <FarmObjectPop>(); farmObjectPop.SetActivePop(type, cameraTransform, adjustY); yield break; }