public void OnTick()
{
DoTimer();
bool stayActive = false;
foreach (var spawned in m_Spawned)
{
var mobile = spawned as Mobile;
if (mobile != null)
{
foreach (Mobile m in mobile.GetMobilesInRange(Core.GlobalMaxUpdateRange))
{
if (ValidTrigger(m))
{
stayActive = true;
break;
}
}
}
else
{
var item = spawned as Item;
if (item != null)
{
foreach (Mobile m in item.GetMobilesInRange(Core.GlobalMaxUpdateRange))
{
if (ValidTrigger(m))
{
stayActive = true;
break;
}
}
}
}
if (stayActive)
{
break;
}
}
if (stayActive)
{
Defrag();
if (IsEmpty)
{
Respawn();
}
else
{
Spawn();
}
}
else
{
RemoveSpawned();
m_Running = false;
}
}