public bool MoveNext() { while ( true ) { if ( m_Enumerator.MoveNext() ) { object o; try { o = m_Enumerator.Current; } catch { continue; } if ( o is Mobile ) { Mobile m = (Mobile) o; if ( m_Bounds.Contains( m.Location ) ) { m_Current = o; return true; } } else if ( o is Item ) { Item item = (Item) o; if ( item.Parent == null && m_Bounds.Contains( item.Location ) ) { m_Current = o; return true; } } } else if ( m_Stage == 0 ) { m_Enumerator.Free(); m_Enumerator = SectorEnumerator.Instantiate( m_Map, m_Bounds, SectorEnumeratorType.Mobiles ); m_Current = null; m_Stage = 1; } else { m_Enumerator.Free(); m_Enumerator = null; m_Current = null; m_Stage = -1; return false; } } }
public void Reset() { m_Current = null; if ( m_Enumerator != null ) m_Enumerator.Free(); m_Enumerator = SectorEnumerator.Instantiate( m_Map, m_Bounds, m_Type );//new SectorEnumerator( m_Map, m_Origin, m_Type, m_Range ); }
public void Reset() { m_Stage = 0; m_Current = null; if ( m_Enumerator != null ) m_Enumerator.Free(); m_Enumerator = SectorEnumerator.Instantiate( m_Map, m_Bounds, SectorEnumeratorType.Items ); }