スタン状態追加
This commit is contained in:
@@ -9,6 +9,8 @@ public class EnemyHealth : MonoBehaviour, IDamageble
|
||||
[SerializeField] private float knockbackDuration = 0.5f;
|
||||
private EnemyAI enemyAI;
|
||||
|
||||
private bool isDead = false;
|
||||
|
||||
void Start()
|
||||
{
|
||||
currentHealth = maxHealth; //HPを代入
|
||||
@@ -41,11 +43,26 @@ public class EnemyHealth : MonoBehaviour, IDamageble
|
||||
|
||||
private void Die()
|
||||
{
|
||||
if(isDead) return;
|
||||
isDead = true;
|
||||
|
||||
Animator anim = GetComponent<Animator>();
|
||||
if(anim != null)
|
||||
{
|
||||
anim.SetTrigger("Dead");
|
||||
}
|
||||
|
||||
Collider col = GetComponent<Collider>();
|
||||
if(col != null)
|
||||
{
|
||||
col.enabled = false;
|
||||
}
|
||||
|
||||
if(enemyAI != null)
|
||||
{
|
||||
enemyAI.DisableAIOnDeath();
|
||||
}
|
||||
|
||||
Destroy(gameObject, 0.5f);
|
||||
Destroy(gameObject, 3.0f);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user