public void ReactToHit() { WanderingAI enemyAI = GetComponent <WanderingAI> (); if (enemyAI != null) { enemyAI.ChangeState(EnemyStates.dead); } Animator enemyAnimator = GetComponent <Animator> (); if (enemyAnimator != null) { enemyAnimator.SetTrigger("Die"); } //StartCoroutine (Die ()); }