| using System.Collections; | 
| using System.Collections.Generic; | 
| using UnityEngine; | 
| using System; | 
| using Cysharp.Threading.Tasks; | 
|   | 
| public class DamageContent : MonoBehaviour | 
| { | 
|     public GameObject line; | 
|   | 
|     public RectTransform parent; | 
|   | 
|     protected List<DamageLine> damageLineList = new List<DamageLine>(); | 
|   | 
|     public PositionTween posTween; | 
|   | 
|     public ScaleTween scaleTween; | 
|   | 
|     private BattleDmgInfo battleDmgInfo; | 
|   | 
|     void Awake() | 
|     { | 
|         line.SetActive(false); | 
|     } | 
|   | 
|     public async void SetDamage(BattleDmgInfo _damageInfo, Action _onComplete) | 
|     { | 
|         battleDmgInfo = _damageInfo; | 
|   | 
|         var damages = battleDmgInfo.battleDamageList; | 
|   | 
|         for (int i = damages.Count; i < damageLineList.Count; i++) | 
|         { | 
|             damageLineList[i].SetActive(false); | 
|         } | 
|   | 
|         posTween.Play(_onComplete); | 
|   | 
|         if (battleDmgInfo.IsCrit()) | 
|         { | 
|             scaleTween.Play(); | 
|         } | 
|   | 
|         for (int i = 0; i < damages.Count; i++) | 
|         { | 
|             if (i >= damageLineList.Count) | 
|             { | 
|                 GameObject newLine = GameObject.Instantiate(line, parent); | 
|                 damageLineList.Add(newLine.GetComponent<DamageLine>()); | 
|             } | 
|             damageLineList[i].SetActive(true); | 
|             damageLineList[i].SetDamage(damages[i]); | 
|             await UniTask.Delay(100); | 
|         } | 
|     } | 
|   | 
|     public void Stop() | 
|     { | 
|         posTween.Stop(); | 
|         if (battleDmgInfo.IsCrit()) | 
|         { | 
|             scaleTween.Stop(); | 
|         } | 
|     } | 
|   | 
|     public void Resume() | 
|     { | 
|         posTween.Resume(); | 
|         if (battleDmgInfo.IsCrit()) | 
|         { | 
|             scaleTween.Resume(); | 
|         } | 
|     } | 
| } |