유닛이 죽었을때 시체농락 하는 시스템 제거

This commit is contained in:
김판돌 2023-12-04 21:28:02 +09:00
parent 152bc5d135
commit 7e5df63807
1 changed files with 6 additions and 5 deletions

View File

@ -18,7 +18,8 @@ public class UnitCtrl : MonoBehaviour
float delay; float delay;
bool isDie = false; bool _isDie = false;
public bool isDie { get { return _isDie; } }
public void DataSet(long tableIndex) public void DataSet(long tableIndex)
{ {
@ -40,7 +41,7 @@ public class UnitCtrl : MonoBehaviour
enemyUnits = new List<UnitCtrl>(); enemyUnits = new List<UnitCtrl>();
isHomeAttack = false; isHomeAttack = false;
delay = 0; delay = 0;
isDie = false; _isDie = false;
} }
private void Start() private void Start()
{ {
@ -57,7 +58,7 @@ public class UnitCtrl : MonoBehaviour
} }
private void Update() private void Update()
{ {
if (PlayCtrl.Instance.isEndGame || isDie) if (PlayCtrl.Instance.isEndGame || _isDie)
return; return;
delay -= Time.deltaTime; delay -= Time.deltaTime;
if (delay > 0) if (delay > 0)
@ -90,7 +91,7 @@ public class UnitCtrl : MonoBehaviour
} }
else else
{ {
if (enemyUnits[0] != null) if (enemyUnits[0] != null && !enemyUnits[0].isDie)
{ {
anim.SetTrigger("attack"); anim.SetTrigger("attack");
enemyUnits[0].Attack(unit.attack); enemyUnits[0].Attack(unit.attack);
@ -153,7 +154,7 @@ public class UnitCtrl : MonoBehaviour
anim.SetBool("isDie", true); anim.SetBool("isDie", true);
components[0].enabled = false; components[0].enabled = false;
components[1].enabled = false; components[1].enabled = false;
isDie = true; _isDie = true;
Destroy(gameObject, 1.0f); Destroy(gameObject, 1.0f);
} }
} }