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