本文整理汇总了C#中Server.Map.CanFit方法的典型用法代码示例。如果您正苦于以下问题:C# Map.CanFit方法的具体用法?C# Map.CanFit怎么用?C# Map.CanFit使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Server.Map
的用法示例。
在下文中一共展示了Map.CanFit方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetFloorZ
private static bool GetFloorZ( Map map, int x, int y, out int z )
{
LandTile lt = map.Tiles.GetLandTile(x, y);
if ( IsFloor( lt.ID ) && map.CanFit( x, y, lt.Z, 16, false, false ) )
{
z = lt.Z;
return true;
}
StaticTile[] tiles = map.Tiles.GetStaticTiles(x, y);
for ( int i = 0; i < tiles.Length; ++i )
{
StaticTile t = tiles[i];
ItemData id = TileData.ItemTable[t.ID & TileData.MaxItemValue];
if ( IsStaticFloor( t.ID ) && map.CanFit( x, y, t.Z + (id.Surface ? id.CalcHeight : 0), 16, false, false ) )
{
z = t.Z + (id.Surface ? id.CalcHeight : 0);
return true;
}
}
z = 0;
return false;
}
示例2: CouldFit
public static AddonFitResult CouldFit( Point3D p, Map map, Mobile from, ref BaseHouse house )
{
if ( !map.CanFit( p.X, p.Y, p.Z, 20, false, true, true ) )
return AddonFitResult.Blocked;
else if ( !BaseAddon.CheckHouse( from, p, map, 20, ref house ) )
return AddonFitResult.NotInHouse;
else
return CheckDoors( p, 20, house );
}
示例3: GetSpawnerZ
public static int GetSpawnerZ( int x, int y, Map map )
{
int z = map.GetAverageZ( x, y );
if ( map.CanFit( x, y, z, 16, false, false ) )
return z;
for ( int i = 1; i <= 20; ++i )
{
if ( map.CanFit( x, y, z + i, 16, false, false ) )
return z + i;
if ( map.CanFit( x, y, z - i, 16, false, false ) )
return z - i;
}
return z;
}
示例4: CouldFit
public bool CouldFit( IPoint3D p, Map map )
{
if ( !map.CanFit( p.X, p.Y, p.Z, this.ItemData.Height ) )
return false;
if ( this.ItemID == 0x232C )
return BaseAddon.IsWall( p.X, p.Y - 1, p.Z, map ); // North wall
else
return BaseAddon.IsWall( p.X - 1, p.Y, p.Z, map ); // West wall
}
示例5: CouldFit
public bool CouldFit( IPoint3D p, Map map )
{
if ( map == null || !map.CanFit( p.X, p.Y, p.Z, ItemData.Height ) )
return false;
if ( FacingSouth )
return BaseAddon.IsWall( p.X, p.Y - 1, p.Z, map ); // north wall
else
return BaseAddon.IsWall( p.X - 1, p.Y, p.Z, map ); // west wall
}
示例6: CouldFit
public bool CouldFit( IPoint3D p, Map map )
{
if ( map == null || !map.CanFit( p.X, p.Y, p.Z, ItemData.Height ) )
return false;
if ( Type == StoneFaceTrapType.NorthWestWall )
return BaseAddon.IsWall( p.X, p.Y - 1, p.Z, map ) && BaseAddon.IsWall( p.X - 1, p.Y, p.Z, map ); // north and west wall
else if ( Type == StoneFaceTrapType.NorthWall )
return BaseAddon.IsWall( p.X, p.Y - 1, p.Z, map ); // north wall
else if ( Type == StoneFaceTrapType.WestWall )
return BaseAddon.IsWall( p.X - 1, p.Y, p.Z, map ); // west wall
return false;
}
示例7: CouldFit
public virtual bool CouldFit( IPoint3D p, Map map )
{
Point3D point = new Point3D( p.X, p.Y, p.Z );
if ( map == null || !map.CanFit( point, 20 ) )
return false;
BaseHouse house = BaseHouse.FindHouseAt( point, map, 20 );
if ( house == null )
return false;
AddonFitResult result = CharacterStatueTarget.CheckDoors( point, 20, house );
if ( result == AddonFitResult.Valid )
return true;
return false;
}
示例8: CouldFit
public AddonFitResult CouldFit( IPoint3D p, Map map, Mobile from, ref List<BaseHouse> houses )
{
if ( PlayerGovernmentSystem.IsAtCity( this ) )
return AddonFitResult.Valid;
if ( Deleted )
return AddonFitResult.Blocked;
if ( houses == null )
houses = new List<BaseHouse>();
foreach ( AddonComponent c in m_Components )
{
Point3D p3D = new Point3D( p.X + c.Offset.X, p.Y + c.Offset.Y, p.Z + c.Offset.Z );
if ( !map.CanFit( p3D.X, p3D.Y, p3D.Z, c.ItemData.Height, false, true, ( c.Z == 0 ) ) )
{
//World.Broadcast(1154, true, "Blocked");
return AddonFitResult.Blocked;
}
else if ( !CheckHouse( from, p3D, map, c.ItemData.Height, ref houses ) )
{
//World.Broadcast(1154, true, "Not in House");
return AddonFitResult.NotInHouse;
}
if ( c.NeedsWall )
{
Point3D wall = c.WallPosition;
if ( !IsWall( p3D.X + wall.X, p3D.Y + wall.Y, p3D.Z + wall.Z, map ) )
return AddonFitResult.NoWall;
}
}
foreach ( BaseHouse house in houses )
{
ArrayList doors = house.Doors;
for ( int i = 0; i < doors.Count; ++i )
{
BaseDoor door = doors[i] as BaseDoor;
if ( door != null && door.Open )
return AddonFitResult.DoorsNotClosed;
Point3D doorLoc = door.GetWorldLocation();
int doorHeight = door.ItemData.CalcHeight;
foreach ( AddonComponent c in m_Components )
{
Point3D addonLoc = new Point3D( p.X + c.Offset.X, p.Y + c.Offset.Y, p.Z + c.Offset.Z );
int addonHeight = c.ItemData.CalcHeight;
if ( Utility.InRange( doorLoc, addonLoc, 1 ) && (addonLoc.Z == doorLoc.Z || ((addonLoc.Z + addonHeight) > doorLoc.Z && (doorLoc.Z + doorHeight) > addonLoc.Z)) )
return AddonFitResult.DoorTooClose;
}
}
}
return AddonFitResult.Valid;
}
示例9: AdjustField
public static bool AdjustField( ref Point3D p, Map map, int height, bool mobsBlock )
{
if( map == null )
return false;
for( int offset = 0; offset < 10; ++offset )
{
Point3D loc = new Point3D( p.X, p.Y, p.Z - offset );
if( map.CanFit( loc, height, true, mobsBlock ) )
{
p = loc;
return true;
}
}
return false;
}
示例10: CouldFit
public virtual AddonFitResult CouldFit( bool blocking, IPoint3D p, Map map, Mobile from, ref ArrayList houseList )
{
if ( Deleted )
return AddonFitResult.Blocked;
ArrayList houses = new ArrayList();
foreach ( AddonComponent c in m_Components )
{
Point3D p3D = new Point3D( p.X + c.Offset.X, p.Y + c.Offset.Y, p.Z + c.Offset.Z );
CanFitFlags flags = CanFitFlags.checkMobiles;
if (c.Z == 0) flags |= CanFitFlags.requireSurface;
if ( !map.CanFit( p3D.X, p3D.Y, p3D.Z, c.ItemData.Height, flags ) )
return AddonFitResult.Blocked;
else if ( !CheckHouse( from, p3D, map, c.ItemData.Height, houses ) )
return AddonFitResult.NotInHouse;
}
foreach ( BaseHouse house in houses )
{
ArrayList doors = house.Doors;
for ( int i = 0; i < doors.Count; ++i )
{
BaseDoor door = doors[i] as BaseDoor;
if ( door != null && door.Open )
return AddonFitResult.DoorsNotClosed;
Point3D doorLoc = door.GetWorldLocation();
int doorHeight = door.ItemData.CalcHeight;
foreach ( AddonComponent c in m_Components )
{
Point3D addonLoc = new Point3D( p.X + c.Offset.X, p.Y + c.Offset.Y, p.Z + c.Offset.Z );
int addonHeight = c.ItemData.CalcHeight;
if ( Utility.InRange( doorLoc, addonLoc, 1 ) && (addonLoc.Z == doorLoc.Z || ((addonLoc.Z + addonHeight) > doorLoc.Z && (doorLoc.Z + doorHeight) > addonLoc.Z)) )
if (blocking == true)
return AddonFitResult.DoorTooClose;
}
}
}
houseList = houses;
return AddonFitResult.Valid;
}
示例11: Explode
public virtual void Explode( Mobile from, Point3D loc, Map map )
{
if ( Deleted || map == null )
return;
Consume();
// Check if any other players are using this potion
for ( int i = 0; i < m_Users.Count; i ++ )
{
ThrowTarget targ = m_Users[ i ].Target as ThrowTarget;
if ( targ != null && targ.Potion == this )
Target.Cancel( from );
}
// Effects
Effects.PlaySound( loc, map, 0x20C );
for ( int i = -2; i <= 2; i ++ )
{
for ( int j = -2; j <= 2; j ++ )
{
Point3D p = new Point3D( loc.X + i, loc.Y + j, loc.Z );
if ( map.CanFit( p, 12, true, false ) && from.InLOS( p ) )
new InternalItem( from, p, map, MinDamage, MaxDamage );
}
}
}
示例12: BlastEffect
public virtual void BlastEffect( Point3D p, Map map )
{
if ( map.CanFit( p, 12, true, false ) )
Effects.SendLocationEffect( p, map, 0x376A, 4, 9 );
}
示例13: CouldFit
public virtual AddonFitResult CouldFit( IPoint3D p, Map map, Mobile from, ref BaseHouse house )
{
if ( Deleted )
return AddonFitResult.Blocked;
foreach ( AddonComponent c in m_Components )
{
Point3D p3D = new Point3D( p.X + c.Offset.X, p.Y + c.Offset.Y, p.Z + c.Offset.Z );
if ( !map.CanFit( p3D.X, p3D.Y, p3D.Z, c.ItemData.Height, false, true, ( c.Z == 0 ) ) )
return AddonFitResult.Blocked;
else if ( !CheckHouse( from, p3D, map, c.ItemData.Height, ref house ) )
return AddonFitResult.NotInHouse;
if ( c.NeedsWall )
{
Point3D wall = c.WallPosition;
if ( !IsWall( p3D.X + wall.X, p3D.Y + wall.Y, p3D.Z + wall.Z, map ) )
return AddonFitResult.NoWall;
}
}
ArrayList doors = house.Doors;
for ( int i = 0; i < doors.Count; ++i )
{
BaseDoor door = doors[i] as BaseDoor;
Point3D doorLoc = door.GetWorldLocation();
int doorHeight = door.ItemData.CalcHeight;
foreach ( AddonComponent c in m_Components )
{
Point3D addonLoc = new Point3D( p.X + c.Offset.X, p.Y + c.Offset.Y, p.Z + c.Offset.Z );
int addonHeight = c.ItemData.CalcHeight;
if ( Utility.InRange( doorLoc, addonLoc, 1 ) && (addonLoc.Z == doorLoc.Z || ((addonLoc.Z + addonHeight) > doorLoc.Z && (doorLoc.Z + doorHeight) > addonLoc.Z)) )
return AddonFitResult.DoorTooClose;
}
}
return AddonFitResult.Valid;
}
示例14: IsValidLandLocation
public static bool IsValidLandLocation( Point3D p, Map map )
{
return map.CanFit( p.X, p.Y, p.Z, 16, false, false );
}
示例15: EffectLine
public static void EffectLine( Point3D start, Point3D end, Map map )
{
if( start.Equals( end ) )
return;
int difX = Math.Abs( start.X - end.X );
int difY = Math.Abs( start.Y - end.Y );
int x = start.X;
int y = start.Y;
int avgX = (int) Math.Round( difY != 0 ? difX / (double) difY : 0 );
int avgY = (int) Math.Round( difX != 0 ? difY / (double) difX : 0 );
while ( x != end.X && y != end.Y )
{
Point3D p = new Point3D( x, y, start.Z );
if ( map.CanFit( p, 12, true, false ) )
Effects.SendLocationEffect( p, map, 0x376A, 4, 9 );
if ( avgX <= 0 )
{
if ( x < end.X )
x += 1;
else if ( x > end.X )
x -= 1;
avgX = (int) Math.Round( difY != 0 ? difX / (double) difY : 0 );
}
if ( avgY <= 0 )
{
if ( y < end.Y )
y += 1;
else if ( y > end.Y )
y -= 1;
avgY = (int) Math.Round( difX != 0 ? difY / (double) difX : 0 );
}
avgX -= 1;
avgY -= 1;
}
}