using UnityEngine;
public class EnemyHealth : MonoBehaviour
{
public int health;
public void GetDamage(int amount)
{
health -= amount;
if (health <= 0)
{
Destroy(gameObject);
}
}
}
using UnityEngine;
public class EnemyHealth : MonoBehaviour.
{
public int dusmancan;
public void GetDamage(int amount)
{
dusmancan -= amount;
if (dusmancan == 0)
{
Destroy(gameObject);
}
}
}
Kodu bu şekilde değiştirdim fakat sonuç yine aynı can 0'a geldiğinde nesne yok olmuyor.
C#:
using UnityEngine;
public class EnemyHealth : MonoBehaviour.
{
public int dusmancan;
public void GetDamage(int amount)
{
dusmancan -= amount;
}
void Update (){
if(dusmancan <=0){
Destroy(gameObject);
}
}
}
Kodu bu şekilde değiştirdim ve oldu teşekkür ederim yardımlarınız için.