public override void OnStart(Enemy enemy) { this.enemy = enemy; navMeshAgent = enemy.GetComponent <NavMeshAgent>(); navMeshAgent.updatePosition = false; navMeshAgent.updateRotation = false; trackedObject = GameManager.instance.GetPlayer().transform; swarm = GameManager.instance.GetComponent <Swarm>(); if (swarm == null) { swarm = GameManager.instance.gameObject.AddComponent <Swarm>(); } swarm.AddAgent(navMeshAgent); enemy.OnDeath += Enemy_OnDeath; enemy.OnDamage += Enemy_OnDamage; updateCoroutine = enemy.StartCoroutine(UpdateCoroutine()); groundedCoroutine = enemy.StartCoroutine(GroundedCoroutine()); }