protected void OnShowHUDText(object sender, GameEventArgs e) { SkillEffectEvent ne = (SkillEffectEvent)e; if (ne == null) { return; } Entity pCaster = GameEntry.Entity.GetGameEntity(ne.CasterID); if (pCaster == null) { return; } Entity pTarget = GameEntry.Entity.GetGameEntity(ne.TargetID); if (pTarget == null) { return; } if ((ne.EffectType & (int)eTriggerNotify.TriggerNotify_Damage) != 0) { Vector3 vOffset = pTarget.GetPos() - pCaster.GetPos(); vOffset.y = 0; Camera pCamera = GameEntry.CameraMgr.GetCurEngineCamera(); if (pCamera == null || pCamera.transform == null) { return; } Vector3 vRight = pCamera.transform.right; vRight.y = 0; float dot = Vector3.Dot(vOffset, vRight); bl_Guidance dir = dot <= 0 ? bl_Guidance.LeftDown : bl_Guidance.RightDown; HUDRoot.NewText(Utility.Text.Format("- {0:N1}", ne.EffectValue), pTarget.CachedTransform, Color.red, 8, 20f, -1f, 2.2f, dir); } else if ((ne.EffectType & (int)eTriggerNotify.TriggerNotify_Heal) != 0) { HUDRoot.NewText(Utility.Text.Format("+ {0:N1}", ne.EffectValue), pTarget.CachedTransform, Color.green, 8, 20f, 0, 0, bl_Guidance.Up); } }
/// <summary> /// send a new event, to create a new floating text /// </summary> public void NewText(string text, Transform trans, Color color, int size, float speed, float yAcceleration, float yAccelerationScaleFactor, bl_Guidance movement) { GameObject t = Instantiate(TextPrefab) as GameObject; //Create new text info to instatiate bl_Text item = t.GetComponent <bl_Text>(); item.m_Speed = speed; item.m_Color = color; item.m_Transform = trans; item.m_text = text; item.m_Size = size; item.movement = movement; item.Yquickness = yAcceleration; item.YquicknessScaleFactor = yAccelerationScaleFactor; print(1); t.transform.SetParent(CanvasParent, false); //t.GetComponent<RectTransform>().anchoredPosition = Vector2.zero; texts.Add(item); }
/// <summary> /// /// </summary> /// <param name="text"></param> /// <param name="trans"></param> /// <param name="place"></param> public void NewText(string text, Transform trans, bl_Guidance place) { NewText(text, trans, Color.white, 8, 20f, 0, 2.2f, place); }
/// <summary> /// send a new event, to create a new floating text /// </summary> public void NewText(string text, Transform trans, Color color, int size, float speed, float yAcceleration, float yAccelerationScaleFactor, bl_Guidance movement) { GameObject t = Instantiate(TextPrefab) as GameObject; //Create new text info to instatiate bl_Text item = t.GetComponent<bl_Text>(); item.m_Speed = speed; item.m_Color = color; item.m_Transform = trans; item.m_text = text; item.m_Size = size; item.movement = movement; item.Yquickness = yAcceleration; item.YquicknessScaleFactor = yAccelerationScaleFactor; t.transform.SetParent(CanvasParent, false); t.GetComponent<RectTransform>().anchoredPosition = Vector2.zero; texts.Add(item); }
/// <summary> /// /// </summary> /// <param name="text"></param> /// <param name="trans"></param> /// <param name="place"></param> public void NewText(string text, Transform trans, bl_Guidance place) { NewText(text, trans, Color.white, 8, 20f, 0, 2.2f, place); }
public void NewText(string text, Transform trans, Color color, int size, float speed, float yAcceleration, float yAccelerationScaleFactor, bl_Guidance movement) { HUDTextInfo info = new HUDTextInfo(trans, text); info.Side = movement; info.Size = size; info.Speed = speed; info.VerticalAceleration = yAcceleration; info.VerticalFactorScale = yAccelerationScaleFactor; info.Color = color; NewText(info); }
/// <summary> /// send a new event, to create a new floating text /// </summary> public GameObject NewText(string text, HUDType hudType, Transform trans, Color color, int size, float speed, float yAcceleration, float yAccelerationScaleFactor, bl_Guidance movement) { GameObject t = Instantiate(TextPrefab) as GameObject; //Create new text info to instatiate bl_Text item = t.GetComponent <bl_Text>(); item.m_Speed = speed; item.m_Color = color; item.m_Transform = trans; // text = ""; item.m_text = ""; item.m_Size = size; item.movement = movement; item.Yquickness = yAcceleration; item.YquicknessScaleFactor = yAccelerationScaleFactor; t.transform.SetParent(CanvasParent, false); // t.GetComponent<RectTransform>().anchoredPosition = Vector2.zero; texts.Add(item); HUDImage hudImage = t.GetComponent <HUDImage>(); hudImage.Show(text, hudType); return(item.gameObject); }
/// <summary> /// /// </summary> /// <param name="text"></param> /// <param name="trans"></param> /// <param name="color"></param> /// <param name="place"></param> /// <param name="fontSize"></param> public void SetHUDText(string text, Transform trans, Color color, bl_Guidance place, int fontSize = 8, float speed = 20.0f) { NewText(text, trans, color, fontSize, speed, 1, 2.2f, place); }