Null check so that buildings dont need an animator

This commit is contained in:
craftwill 2024-10-27 15:57:26 -04:00
parent 12e5f4bc55
commit 507b2ce8e0

View File

@ -78,8 +78,13 @@ public class AnimationEntity : MonoBehaviour
public void PlayDieAnim()
{
_animatorEntity.speed = 1;
_animatorEntity.Play("die", 0, 0f);
// Not every entity needs an animator
if (_animatorEntity != null)
{
_animatorEntity.speed = 1;
_animatorEntity.Play("die", 0, 0f);
}
entityState = EntityAnimationState.Dying;
_doSomething = true;
_isDead = true;