public void SetActivePop(FarmObjectPop.PopType type, Transform cameraTransform, float adjustY) { Vector3 worldPosition = base.transform.position + cameraTransform.forward * 2f; if (type == FarmObjectPop.PopType.ARROW) { this.arrow.SetActive(true); Transform transform = this.arrow.transform; Vector3 localPosition = transform.localPosition; localPosition.y += adjustY; transform.localPosition = localPosition; transform.LookAt(worldPosition, cameraTransform.up); } }
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; }