protected void OnLoadRes(string name, System.Object obj) { GameObject go = (GameObject)GameObject.Instantiate(obj as UnityEngine.Object); go.name = "WarViews_UnitHP-" + unitData.id; go.transform.SetParent(War.scene.rootUnitHP); go.transform.localScale = Vector3.one; hpView = go.GetComponent <UnitHP>(); if (unitData.unitType == UnitType.Build) { hpView.colorId = legionData.colorId; hpView.SetBarVisiable(unitData.build_produce); } UIFllowWorldPosition uiFllow = go.GetComponent <UIFllowWorldPosition>(); uiFllow.targetWorld = transform; unitCtl.OnDamage += hpView.OnDamage; // GameObject go = (GameObject)GameObject.Instantiate(obj as UnityEngine.Object); // go.name = go.name.Replace("(Clone)", ""); // go.transform.SetParent(unit.GetAnchor(UnitAnchor.UICanva)); // go.transform.localPosition = new Vector3(2f, -2f, 0f); // go.transform.rotation = Quaternion.Euler(new Vector3(45F, 0F, 0F)); // go.transform.localScale = Vector3.one; // hpView = go.GetComponent<UnitHP>(); }
public void Push(AbstractTextEffect item) { UIFllowWorldPosition uiFllow = item.GetComponent <UIFllowWorldPosition>(); if (uiFllow != null) { uiFllow.enabled = false; } pool.Push(item); if (textEffectManager != null) { textEffectManager.OnOver(item); } }
public AbstractTextEffect Play(TextEffectType type, object val, Color color, Transform transform, Vector3 offset, bool isFllow) { AbstractTextEffect textEffect = Play(type, val, color, transform.position + offset, transform); if (isFllow) { UIFllowWorldPosition uiFllow = textEffect.GetComponent <UIFllowWorldPosition>(); if (uiFllow == null) { uiFllow = textEffect.gameObject.AddComponent <UIFllowWorldPosition>(); } uiFllow.targetWorld = transform; uiFllow.offset = offset; uiFllow.enabled = true; } return(textEffect); }
IEnumerator OnPlay() { yield return(new WaitForSeconds(time)); _coroutine = null; gameObject.SetActive(false); UIFllowWorldPosition uiFllow = gameObject.GetComponent <UIFllowWorldPosition>(); if (uiFllow != null) { uiFllow.enabled = false; } if (pool != null) { pool.Push(this); } }
IEnumerator OnPlay() { yield return(new WaitForEndOfFrame()); beginPosition = BEGION_POSITION + randomScale * Vector3.left * Random.Range(-10F, 10F); inPosition = IN_POSITION + randomScale * Vector3.left * Random.Range(-20F, 20F); outnPosition = OUT_POSITION + randomScale * Vector3.left * Random.Range(-100F, 100F) + Vector3.up * Random.Range(0F, 50F); while (_t < inTime) { _t += Time.deltaTime; _r = _t / inTime; text.color = text.color.SetAlhpa(Mathf.Lerp(0, 1, _r)); text.transform.localPosition = Vector3.Lerp(beginPosition, inPosition, _r); yield return(new WaitForEndOfFrame()); } _t = 0f; while (_t < outTime) { _t += Time.deltaTime; _r = _t / outTime; text.color = text.color.SetAlhpa(Mathf.Lerp(1, 0, _r)); text.transform.localPosition = Vector3.Lerp(inPosition, outnPosition, _r); yield return(new WaitForEndOfFrame()); } _coroutine = null; gameObject.SetActive(false); UIFllowWorldPosition uiFllow = gameObject.GetComponent <UIFllowWorldPosition>(); if (uiFllow != null) { uiFllow.enabled = false; } if (pool != null) { pool.Push(this); } }