/// <summary> /// Do not call this to destroy the agent. Use AgentController.DestroyAgent(). /// </summary> /// <param name="Immediate"></param> internal void _Deactivate(bool Immediate = false) { if (IsActive == false) { Debug.Log("NOASER"); } if (onDeactivate != null) { this.onDeactivate(this); } DeactivateCore(); if (Immediate == false) { if (Animator.IsNotNull()) { Animator.Play(AnimState.Dying); } poolCoroutine = CoroutineManager.StartCoroutine(PoolDelayer()); } else { AgentController.EndLife(this); } }
private IEnumerator <int> PoolDelayer() { deathingIndex = AgentController.DeathingAgents.Add(this); yield return(_deathTime); AgentController.DeathingAgents.RemoveAt(deathingIndex); AgentController.EndLife(this); }
public static void Deactivate() { for (int i = 0; i < PeakGlobalID; i++) { if (GlobalAgentActive[i]) { DestroyAgent(GlobalAgents[i], true); } } CheckDestroyAgent(); for (int i = 0; i < DeathingAgents.PeakCount; i++) { if (DeathingAgents.arrayAllocation[i]) { LSAgent agent = DeathingAgents[i]; AgentController.EndLife(agent); } } DeathingAgents.FastClear(); }