本文整理匯總了C#中Server.Region.OnLocationChanged方法的典型用法代碼示例。如果您正苦於以下問題:C# Region.OnLocationChanged方法的具體用法?C# Region.OnLocationChanged怎麽用?C# Region.OnLocationChanged使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Server.Region
的用法示例。
在下文中一共展示了Region.OnLocationChanged方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: SetLocation
//.........這裏部分代碼省略.........
{
if ( o is Item )
{
Item item = (Item)o;
int range = item.GetUpdateRange( this );
Point3D loc = item.Location;
if ( !Utility.InRange( oldLocation, loc, range ) && Utility.InRange( newLocation, loc, range ) && CanSee( item ) )
item.SendInfoTo( ourState );
}
else if ( o != this && o is Mobile )
{
Mobile m = (Mobile)o;
if ( !Utility.InUpdateRange( newLocation, m.m_Location ) )
continue;
bool inOldRange = Utility.InUpdateRange( oldLocation, m.m_Location );
if ( (isTeleport || !inOldRange) && m.m_NetState != null && m.CanSee( this ) )
{
m.m_NetState.Send( new MobileIncoming( m, this ) );
if ( IsDeadBondedPet )
m.m_NetState.Send( new BondedStatus( 0, m_Serial, 1 ) );
if ( ObjectPropertyList.Enabled )
{
m.m_NetState.Send( OPLPacket );
//foreach ( Item item in m_Items )
// m.m_NetState.Send( item.OPLPacket );
}
}
if ( !inOldRange && CanSee( m ) )
{
ourState.Send( new MobileIncoming( this, m ) );
if ( m.IsDeadBondedPet )
ourState.Send( new BondedStatus( 0, m.m_Serial, 1 ) );
if ( ObjectPropertyList.Enabled )
{
ourState.Send( m.OPLPacket );
//foreach ( Item item in m.m_Items )
// ourState.Send( item.OPLPacket );
}
}
}
}
eable.Free();
}
else
{
eable = map.GetClientsInRange( newLocation );
// We're not attached to a client, so simply send an Incoming
foreach ( NetState ns in eable )
{
if ( (isTeleport || !Utility.InUpdateRange( oldLocation, ns.Mobile.Location )) && ns.Mobile.CanSee( this ) )
{
ns.Send( new MobileIncoming( ns.Mobile, this ) );
if ( IsDeadBondedPet )
ns.Send( new BondedStatus( 0, m_Serial, 1 ) );
if ( ObjectPropertyList.Enabled )
{
ns.Send( OPLPacket );
//foreach ( Item item in m_Items )
// ns.Send( item.OPLPacket );
}
}
}
eable.Free();
}
}
m_Region = Region.Find( m_Location, m_Map );
if ( oldRegion != m_Region )
{
oldRegion.InternalExit( this );
m_Region.InternalEnter( this );
OnRegionChange( oldRegion, m_Region );
}
OnLocationChange( oldLocation );
CheckLightLevels( false );
m_Region.OnLocationChanged( this, oldLocation );
}
}