Only attack if target is not null
This commit is contained in:
parent
e50546b061
commit
7af161f29d
@ -29,9 +29,12 @@ public class Entity : MonoBehaviour
|
||||
protected virtual void Attack(){
|
||||
// jason: TODO Either have target be Entity instead of transform, or skip Attack when GetComponent<Entity>() is null
|
||||
Entity targetEntity = target.GetComponent<Entity>();
|
||||
if(targetEntity != null){
|
||||
bool isTargetAlive = targetEntity.TakeDamage(attackDmg);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected virtual void SpecialAttack(){
|
||||
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user