fix:解决敌人死亡执行瞬间多次执行方法问题
This commit is contained in:
@@ -181,8 +181,9 @@ public class Enemy : MonoBehaviour
|
||||
if(_sender.GetComponent<EnemyBullet>()!=null)
|
||||
return;
|
||||
Damage(value,(bool)info);
|
||||
if (health <= 0)
|
||||
if (health <= 0&& !isDead)
|
||||
{
|
||||
Debug.Log("敌人死亡");
|
||||
Dead();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,16 +37,18 @@ public class EnemyTa : Enemy,IDamagable
|
||||
public override void Update()
|
||||
{
|
||||
base.Update();
|
||||
if (GameManager.Ins.GetCurEnemyListCount() <= 0&& !isDie)
|
||||
if (GameManager.Ins.GetCurEnemyListCount() <= 0&& !isDead)
|
||||
{
|
||||
Debug.Log("敌人死亡2");
|
||||
Dead();
|
||||
}
|
||||
}
|
||||
|
||||
public override void Dead()
|
||||
{
|
||||
if(isDead)
|
||||
return;
|
||||
base.Dead();
|
||||
isDie = true;
|
||||
GameManager.Ins.CurLevelWin(transform.position.ReflectVectorXOZ());
|
||||
GameInit.Ins.PlayAudio("1.7",GameInit.Ins.self.transform,true);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user