using System.Collections;
|
using System.Collections.Generic;
|
using UnityEngine;
|
using System;
|
|
public class DamageContent : MonoBehaviour
|
{
|
public GameObject line;
|
|
public RectTransform parent;
|
|
protected List<DamageLine> damageLineList = new List<DamageLine>();
|
|
public PositionTween posTween;
|
|
void Awake()
|
{
|
line.SetActive(false);
|
}
|
|
public void SetDamage(List<int> damages, Action _onComplete)
|
{
|
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]);
|
}
|
|
for (int i = damages.Count; i < damageLineList.Count; i++)
|
{
|
damageLineList[i].SetActive(false);
|
}
|
|
posTween.Play(_onComplete);
|
}
|
|
public void Stop()
|
{
|
posTween.Stop();
|
}
|
|
public void Resume()
|
{
|
posTween.Resume();
|
}
|
}
|