using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; namespace BF { public class BattleEffectNumber : MonoBehaviour { public Animator animator; public TMPro.TextMeshProUGUI effectText; private const string CritString = "c"; private float putbackTime = 0; private bool isPause = false; [System.NonSerialized] public int ColorType = 0; private void Update() { if (isPause) { return; } putbackTime -= Time.deltaTime; if (putbackTime <= 0.0f) { effectText.text = string.Empty; BFMain.Instance.BattleMgr.PoolHelper.PutBackEffectText(this, ColorType); } } public void ShowEffectNumber(int effectType, string effectNumber) { putbackTime = BattleTMPNumber.PUT_BACK_TIME; switch (effectType) { case BattleConst.EFFECT_TYPE_MOVE_L: effectText.text = effectNumber; animator.Play(BattleConst.ANIMATOR_HASH_NAME_NUMBER_MOVE_L, -1, 0); break; case BattleConst.EFFECT_TYPE_MOVE_R: effectText.text = effectNumber; animator.Play(BattleConst.ANIMATOR_HASH_NAME_NUMBER_MOVE_R, -1, 0); break; case BattleConst.EFFECT_TYPE_MOVE_L_2: effectText.text = effectNumber; animator.Play(BattleConst.ANIMATOR_HASH_NAME_NUMBER_MOVE_L_2, -1, 0); break; case BattleConst.EFFECT_TYPE_MOVE_R_2: effectText.text = effectNumber; animator.Play(BattleConst.ANIMATOR_HASH_NAME_NUMBER_MOVE_R_2, -1, 0); break; case BattleConst.EFFECT_TYPE_CRIT: effectText.text = effectNumber; animator.Play(BattleConst.ANIMATOR_HASH_NAME_NUMBER_CRIT, -1, 0); break; case BattleConst.EFFECT_TYPE_BUFF: effectText.text = effectNumber; animator.Play(BattleConst.ANIMATOR_HASH_NAME_NUMBER_BUFF, -1, 0); break; default: effectText.text = effectNumber; animator.Play(BattleConst.ANIMATOR_HASH_NAME_NUMBER_BUFF, -1, 0); break; } } public void SetEnabled(bool enabled) { animator.enabled = enabled; this.enabled = enabled; } public void SetPause() { isPause = true; animator.speed = 0.0f; } public void SetResume() { isPause = false; animator.speed = 1.0f; } } }