// Bubble text from head of our character public void BubbleUpEffect(string text, Color color, Vector3 source, float size_factor) { if (!_BubbleEffectEnabled) { return; } Transform t = FindFirstUnusedSlot(AnimationPlayer.BubbleType.BitmapFont); t.position = source; t.gameObject.SetActive(true); AnimationPlayer ap = t.gameObject.GetComponent <AnimationPlayer>(); ap.eventReceiver = gameObject; BubbleEffect be = t.gameObject.GetComponent <BubbleEffect>(); UILabel label = be._text; label.text = text; label.color = color; label.transform.localScale = new Vector3(_baseScale, _baseScale, 1.0f) * size_factor; AnimationPlayer player = t.GetComponent <AnimationPlayer>(); player.Play(); TweenAlpha alpha = t.gameObject.GetComponentInChildren <TweenAlpha>(); alpha.enabled = true; alpha.Reset(); }
// Create text use dynamic public void BubbleUpDynamicFont(string text, string text2, Vector3 source, bool symbol) { if (!_BubbleEffectEnabled) { return; } Transform t = FindFirstUnusedSlot(AnimationPlayer.BubbleType.DynamicFont); t.position = source; t.gameObject.SetActive(true); BubbleEffect be = t.gameObject.GetComponent <BubbleEffect>(); UILabel label = be._text; label.text = text; be._text2.text = text2; be._sprite.SetActive(symbol); TweenAlpha alpha = t.gameObject.GetComponentInChildren <TweenAlpha>(); alpha.enabled = true; alpha.Reset(); AnimationPlayer player = t.gameObject.GetComponent <AnimationPlayer>(); player.eventReceiver = gameObject; player.callWhenFinished = "OnFinishBubble"; player.Play(); }
public void CreateBubbleEffect() { for (int i = 0; i < bubbleEffectMaxCount; i++) { BubbleEffect bubble = Instantiate(bubblePrefab, parent); bubble.gameObject.SetActive(false); bubbleEffectList.Add(bubble); } }
public void SetBubbleEffect(Vector2 _pos, Vector2 _scale, int _sortOrder, Color _color) { if (bubbleEffectList.Count < bubbleEffectMaxCount) { BubbleEffect bubble = Instantiate(bubblePrefab, parent); bubble.SetBubbleEffect(_pos, _scale, _sortOrder, _color); bubbleEffectList.Add(bubble); } else { activeBubbleNum = activeBubbleNum + 1; if (activeBubbleNum >= bubbleEffectList.Count) { activeBubbleNum = 0; } bubbleEffectList[activeBubbleNum].gameObject.SetActive(true); bubbleEffectList[activeBubbleNum].SetBubbleEffect(_pos, _scale, _sortOrder, _color); } }