private Brush GetColorForType(FloatingTextType type) { switch (type) { case FloatingTextType.SCORE: return(Brushes.RoyalBlue); case FloatingTextType.BONUS_SCORE: return(Brushes.Goldenrod); case FloatingTextType.DAMAGE: return(Brushes.Red); case FloatingTextType.CHAT: return(Brushes.Blue); case FloatingTextType.HEAL: return(Brushes.Green); case FloatingTextType.SYSTEM: return(Brushes.DarkMagenta); case FloatingTextType.GOLD: return(Brushes.Goldenrod); default: return(Brushes.Black); } }
// Use this for initialization public void ShowFloatingText(FloatingTextType type, string text) { m_text.text = text; switch (type) { case FloatingTextType.GenericFloatingText: m_text.color = Color.white; break; case FloatingTextType.DamageFloatingText: m_text.color = m_damageColor; break; case FloatingTextType.GoldFloatingText: m_text.color = m_goldColor; break; case FloatingTextType.SideEffectFloatingText: m_text.color = m_sideEffectColor; break; case FloatingTextType.HealFloatingText: m_text.color = m_healEffectColor; break; default: break; } }
public void DetermineType(FloatingTextType type) { textType = type; if (type == FloatingTextType.Damage) { xDev = .5f; yDev = 0; zDev = 0; riseMod = -2.5f; } if (type == FloatingTextType.Heal) { xDev = -.5f; yDev = 0f; zDev = 0; riseMod = 2.5f; } if (type == FloatingTextType.Buff) { xDev = 0; yDev = 0; zDev = 0; riseMod = 4f; } if (type == FloatingTextType.Basic) { xDev = 0; yDev = 1; zDev = 0; riseMod = 1.5f; } }
public void AddFloatingText(string text, Vector position, float time, FloatingTextType type, float fontSize = SIZE_SMALL, bool disableRandomPos = false, bool send = false) { if (!disableRandomPos) { position = new Vector(position.X + mgr.GetRandomGenerator().Next(-5, 5), position.Y + mgr.GetRandomGenerator().Next(-5, 5)); } newFloatingTexts.Add(new FloatingText(text, position, time, type, fontSize, send)); }
public void FloatingText(float a_Message, Vector3 a_Anchor, FloatingTextType a_Type) { switch (a_Type) { case FloatingTextType.MagicDamage: case FloatingTextType.PhysicalDamage: FloatingText(string.Format("-{0:0.0}", a_Message), a_Anchor, a_Type); break; } }
public FloatingText(string text, Vector position, float time, FloatingTextType type, float fontSize, bool send) { Text = text; Position = position; TotalTime = time; RemainingTime = time; Type = type; FontSize = fontSize; Send = send; CS = new SquareCollisionShape(); LastCollisionMovedUp = false; CollisionArea = new Rect(); }
public void FloatingText(string a_Message, Vector3 a_Anchor, FloatingTextType a_Type) { switch (a_Type) { case FloatingTextType.Overhead: a_Anchor.z += 0.5f; CreateFloatingText(a_Message, Color.black, a_Anchor); break; case FloatingTextType.PhysicalDamage: CreateFloatingText(a_Message, new Color(1, 0, 0), a_Anchor); break; case FloatingTextType.MagicDamage: CreateFloatingText(a_Message, new Color(0, 0, 1), a_Anchor); break; } }
private GameObject GetPrefab(FloatingTextType floatType) { switch (floatType) { case FloatingTextType.FloatingTextType_Perfect: return(PrefabPerfect); case FloatingTextType.FloatingTextType_Good: return(PrefabGood); case FloatingTextType.FloatingTextType_Bad: return(PrefabBad); case FloatingTextType.FloatingTextType_Miss: return(PrefabMiss); } return(null); }
public void CreateFloatingText(Vector3 location, FloatingTextType type, string text) { // Get the data from the dictionary FloatingTextData data = FloatingTextDatas[type]; // Create parent object (so that all animations are relative to this location) GameObject parent = new GameObject(); parent.name = text; parent.transform.parent = ParentFloatingTexts; parent.transform.position = location; FloatingTexts.Add(parent.transform); // Instantiate a new floating text object GameObject floatingText = Instantiate(FloatingTextPrefab); floatingText.transform.parent = parent.transform; floatingText.transform.localPosition = Vector3.zero; // Rotate to face the camera Vector3 camLocation = MainCamera.transform.position; parent.transform.rotation = Quaternion.LookRotation(parent.transform.position - camLocation); // Update text component TextMesh textMesh = floatingText.GetComponent <TextMesh>(); textMesh.color = data.TextColor; textMesh.text = text; textMesh.fontSize = data.FontSize; // Start playing animation Animator anim = floatingText.GetComponent <Animator>(); anim.Play(data.Animation); // Destroy once animation is complete Destroy(parent, anim.GetCurrentAnimatorClipInfo(0)[0].clip.length); // Play sound AS.PlayOneShot(Point); }
public void NewFloatingText(FloatingTextType floatType, Vector3 pos) { GameObject prefab = GetPrefab(floatType); if (prefab == null) { return; } GameObject go = GameObject.Instantiate(prefab); Vector3 ScreenPos = Camera.main.WorldToScreenPoint(pos); Vector2 uiPos = new Vector2(); RectTransform rtf = go.transform as RectTransform; RectTransform parentRtf = UIRoot.Instance.transform as RectTransform; RectTransformUtility.ScreenPointToLocalPointInRectangle(parentRtf, ScreenPos, null, out uiPos); rtf.anchoredPosition = new Vector2(uiPos.x, uiPos.y + 65f); rtf.SetParent(UIRoot.Instance.transform, false); }
public void AddFloatingText(int value, Vector position, float time, FloatingTextType type, float fontSize = SIZE_SMALL, bool disableRandomPos = false, bool send = false) { AddFloatingText(value.ToString(Strings.Culture), position, time, type, fontSize, disableRandomPos, send); }