本文整理汇总了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 );
}
}