private void Die() { healthUI.SetActive(false); state = STATE.DEAD; unitAnimator.SetDamaged(0); unitAnimator.SetFighting(false); unitAnimator.SetDead(true); Destroy(outline); GetComponent <CapsuleCollider>().enabled = false; navMeshAgent.isStopped = true; navMeshAgent.enabled = false; //if (gameObject.tag == "Friendly") // unitManager.RemoveUnit(this.gameObject); if (enemyTag == "Enemy") { PlayerSkillManager.instance.UnitDeath(populationValue); } else { PlayerSkillManager.instance.EnemyDeath(populationValue); } this.enabled = false; Destroy(this); }