Esempio n. 1
0
        /// <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);
            }

            _Deactivate();

            if (Immediate == false)
            {
                if (Animator.IsNotNull())
                {
                    Animator.SetDyingState();
                }

                poolCoroutine = CoroutineManager.StartCoroutine(PoolDelayer());
            }
            else
            {
                AgentController.CompleteLife(this);
            }
        }
Esempio n. 2
0
        private IEnumerator <int> PoolDelayer()
        {
            deathingIndex = AgentController.DeathingAgents.Add(this);


            yield return(_deathTime);

            AgentController.DeathingAgents.RemoveAt(deathingIndex);

            AgentController.CompleteLife(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])
                {
                    RTSAgent agent = DeathingAgents[i];
                    AgentController.CompleteLife(agent);
                }
            }
            DeathingAgents.FastClear();
        }