void UpdateToActive() { int n = _lstToActive.Count; //Profiler.BeginSample ("UpdateToActive:"+n); for (int i = n - 1; i >= 0; i--) { ISceneObjAgent obj = _lstToActive[i]; if (!IntoActive(obj)) { _lstToActive.RemoveAt(i); _lstInactive.Add(obj); _dirtyLstInactive = true; } else // Test collider and Activate it { bool allDp = true; EDependChunkType type = 0; int nDp = _lstActDependences.Count; for (int iDp = 0; iDp < nDp; iDp++) { ISceneObjActivationDependence dp = _lstActDependences[iDp]; if (!dp.IsDependableForAgent(obj, ref type)) { allDp = false; break; } } if (allDp) { //if((type&EDependChunkType.ChunkColMask) == 0 || null != DependenceHitTst(obj)) { _lstToActive.RemoveAt(i); _toActivate.Add(obj); _lstIsActive.Add(obj); } } } } n = _toActivate.Count; if (n > 0) { for (int i = n - 1; i >= 0; i--) { _toActivate[i].OnActivate(); } _toActivate.Clear(); } //_dirtyLstToActive = false; //Profiler.EndSample (); }
void UpdateIsActive() { int n = _lstIsActive.Count; //Profiler.BeginSample ("UpdateIsActive:"+n); for (int i = n - 1; i >= 0; i--) { ISceneObjAgent obj = _lstIsActive[i]; if (ExitActive(obj)) { _lstIsActive.RemoveAt(i); _toDeactivate.Add(obj); _lstInactive.Add(obj); _dirtyLstInactive = true; } else if (_dirtyLstIsActive) { bool allDp = true; EDependChunkType type = 0; int nDp = _lstActDependences.Count; for (int iDp = 0; iDp < nDp; iDp++) { ISceneObjActivationDependence dp = _lstActDependences[iDp]; if (!dp.IsDependableForAgent(obj, ref type)) { allDp = false; break; } } if (!allDp) { _lstIsActive.RemoveAt(i); _toDeactivate.Add(obj); _lstInactive.Add(obj); _dirtyLstInactive = true; } } } n = _toDeactivate.Count; if (n > 0) { for (int i = n - 1; i >= 0; i--) { _toDeactivate[i].OnDeactivate(); } _toDeactivate.Clear(); } _dirtyLstIsActive = false; //Profiler.EndSample (); }