/// <summary> /// 创建受击数字 /// </summary> /// <param name="hitType">受击类型</param> /// <param name="number">伤害数字</param> public void CreateHitNumberObjcet(GetHitType hitType, float number) { HitTextController gameObject = null; switch (hitType) { case GetHitType.Normal: gameObject = GameObject.Instantiate(noramlHitObject); gameObject.transform.SetParent(transform.parent); gameObject.transform.localScale = new Vector3(1, 1, 1); gameObject.transform.localPosition = new Vector2(transform.localPosition.x, transform.localPosition.y); break; case GetHitType.CriticalStrike: gameObject = GameObject.Instantiate(criticalStrikeObject); gameObject.transform.SetParent(transform.parent); gameObject.transform.localScale = new Vector3(1, 1, 1); gameObject.transform.localPosition = new Vector2(transform.localPosition.x, transform.localPosition.y + 200); break; } if (gameObject == null) { return; } gameObject.SetText(number); }
/// <summary> /// 生成添加血量提示物体 /// </summary> private void CreateAddBlood() { HitTextController gameObject = GameObject.Instantiate(AddBloodObject); gameObject.transform.SetParent(transform.parent); gameObject.transform.localScale = new Vector3(1, 1, 1); gameObject.transform.localPosition = new Vector2(transform.localPosition.x, transform.localPosition.y); gameObject.SetText(100); }