本文整理汇总了C#中Map.CanFit方法的典型用法代码示例。如果您正苦于以下问题:C# Map.CanFit方法的具体用法?C# Map.CanFit怎么用?C# Map.CanFit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Map
的用法示例。
在下文中一共展示了Map.CanFit方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Effect
public void Effect( Point3D loc, Map map, bool checkMulti )
{
if ( map == null || (!Core.AOS && Caster.Map != map) )
{
Caster.SendLocalizedMessage( 1005570 ); // You can not gate to another facet.
}
else if ( !map.CanFit( loc.X, loc.Y, loc.Z, 16 ) )
{
Caster.SendLocalizedMessage( 501942 ); // That location is blocked.
}
else if ( (checkMulti && SpellHelper.CheckMulti( loc, map )) )
{
Caster.SendLocalizedMessage( 501942 ); // That location is blocked.
}
else if ( !SpellHelper.CheckTravel( Caster, loc, map, TravelType.Gate ) && Caster.AccessLevel == AccessLevel.Player )
{
Caster.PlaySound( 0x5C );
}
else if ( CheckSequence() )
{
Caster.SendLocalizedMessage( 501024 ); // You open a magical gate to another location
Effects.PlaySound( Caster.Location, Caster.Map, 0x20E );
InternalItem firstGate = new InternalItem( loc, map );
firstGate.MoveToWorld( Caster.Location, Caster.Map );
Effects.PlaySound( loc, map, 0x20E );
InternalItem secondGate = new InternalItem( Caster.Location, Caster.Map );
secondGate.MoveToWorld( loc, map );
}
FinishSequence();
}
示例2: FindGoldLocation
private static Point3D FindGoldLocation(Map map, Point3D center, int range)
{
int cx = center.X;
int cy = center.Y;
for (int i = 0; i < 20; ++i)
{
int x = cx + Utility.Random(range * 2) - range;
int y = cy + Utility.Random(range * 2) - range;
if ((cx - x) * (cx - x) + (cy - y) * (cy - y) > range * range)
continue;
int z = map.GetAverageZ(x, y);
if (!map.CanFit(x, y, z, 6, false, false))
continue;
int topZ = z;
foreach (Item item in map.GetItemsInRange(new Point3D(x, y, z), 0))
{
topZ = Math.Max(topZ, item.Z + item.ItemData.CalcHeight);
}
return new Point3D(x, y, topZ);
}
return center;
}
示例3: 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
}
示例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.CanFit( p.X, p.Y, p.Z, ItemData.Height ))
return false;
if ((ItemID & 0x1) == 0x0)
return (BaseAddon.IsWall( p.X, p.Y - 1, p.Z, map ) && BaseAddon.IsWall( p.X - 1, p.Y - 1, p.Z, map )); // North wall + Upper wall
else
return (BaseAddon.IsWall( p.X - 1, p.Y, p.Z, map ) && BaseAddon.IsWall( p.X - 1, p.Y - 1, p.Z, map )); // West wall + Upper wall
}
示例6: 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;
}
示例7: Effect
public void Effect( Point3D loc, Map map, bool checkMulti )
{
if ( map == null || (!Core.AOS && Caster.Map != map) )
{
Caster.SendLocalizedMessage( 1005569 ); // You can not recall to another facet.
}
else if ( Caster.Kills >= 5 && map != Map.Felucca )
{
Caster.SendLocalizedMessage( 1019004 ); // You are not allowed to travel there.
}
else if ( Server.Misc.WeightOverloading.IsOverloaded( Caster ) )
{
Caster.SendLocalizedMessage( 502359, "", 0x22 ); // Thou art too encumbered to move.
}
else if ( !map.CanFit( loc.X, loc.Y, loc.Z, 16 ) )
{
Caster.SendLocalizedMessage( 501942 ); // That location is blocked.
}
else if ( checkMulti && SpellHelper.CheckMulti( loc, map ) )
{
Caster.SendLocalizedMessage( 501942 ); // That location is blocked.
}
else if ( !SpellHelper.CheckTravel( Caster, loc, map, TravelType.Recall ) && Caster.AccessLevel == AccessLevel.Player )
{
Caster.PlaySound( 0x5C );
}
else if ( CheckSequence() )
{
BaseCreature.TeleportPets( Caster, loc, map, true );
Caster.PlaySound( 0x1FC );
Caster.Map = map;
Caster.Location = loc;
Caster.PlaySound( 0x1FC );
}
FinishSequence();
}
示例8: BlastEffect
public virtual void BlastEffect(Point3D p, Map map)
{
if (map.CanFit(p, 12, true, false))
Effects.SendLocationEffect(p, map, 0x376A, 4, 9);
}
示例9: CouldFit
public virtual AddonFitResult CouldFit(IPoint3D p, Map map, Mobile from, ref BaseHouse house)
{
if (this.Deleted)
return AddonFitResult.Blocked;
foreach (AddonComponent c in this.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 this.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;
}
示例10: RandomPointOneAway
public static Point3D RandomPointOneAway(int x, int y, int z, Map map)
{
Point3D loc = new Point3D(x + Utility.Random(-1, 3), y + Utility.Random(-1, 3), 0);
loc.Z = (map.CanFit(loc, 0)) ? map.GetAverageZ(loc.X, loc.Y) : z;
return loc;
}
示例11: CouldFit
public bool CouldFit(IPoint3D p, Map map)
{
if (!map.CanFit(p.X, p.Y, p.Z, ItemData.Height))
return false;
if (ItemID == m_NorthID)
return BaseAddon.IsWall(p.X, p.Y - 1, p.Z, map); // North wall
return BaseAddon.IsWall(p.X - 1, p.Y, p.Z, map); // West wall
}
示例12: GETVALIDSPAWNLOCATIONANDMAP
public static Point3D GETVALIDSPAWNLOCATIONANDMAP(
TriggerObject trigObject, Map map, int startX, int startY, int endX, int endY, int z, bool requiresurface)
{
if (map == null || map == Map.Internal)
{
return Point3D.Zero;
}
// --- from XmlSpawner2.cs GetSpawnPosition function ---
// try to find a valid spawn location using the z coord of the spawner
// relax the normal surface requirement for mobiles if the flag is set
// try 10 times; this is a potential performance bottleneck
for (int i = 0; i < 10; i++)
{
int x = Utility.RandomMinMax(startX, endX);
int y = Utility.RandomMinMax(startY, endY);
bool fit = requiresurface
? CANFITMOB(trigObject, x, y, z, 16, false, true, true, null, map)
: CANFIT(trigObject, new Point2D(x, y));
// if that fails then try to find a valid z coord
if (fit)
{
return new Point3D(x, y, z);
}
z = map.GetAverageZ(x, y);
fit = requiresurface
? CANFITMOB(trigObject, x, y, z, 16, false, true, true, null, map)
: map.CanFit(x, y, z, 16, true, false, false);
if (fit)
{
return new Point3D(x, y, z);
}
// check for a possible static surface that works
var staticTiles = map.Tiles.GetStaticTiles(x, y, true);
foreach (StaticTile tile in staticTiles)
{
ItemData id = TileData.ItemTable[tile.ID & TileData.MaxItemValue];
//int calcTop = (tile.Z + id.CalcHeight);
if ((id.Flags & TileFlag.Surface) == 0)
{
continue;
}
int top = tile.Z + id.Height;
fit = requiresurface
? CANFITMOB(trigObject, x, y, top, 16, false, true, true, null, map)
: map.CanFit(x, y, top, 16, true, false, false);
if (fit)
{
return new Point3D(x, y, top);
}
}
}
// unable to find a valid spot in 10 tries
return Point3D.Zero;
}
示例13: CouldFit
public virtual bool CouldFit(IPoint3D p, Map map)
{
if (p == null || map == null || map == Map.Internal)
{
return false;
}
var point = new Point3D(p.X, p.Y, p.Z);
if (!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;
}
示例14: IsValidWater
public static bool IsValidWater(Map map, int x, int y, int z)
{
if (!Region.Find(new Point3D(x, y, z), map).AllowSpawn() || !map.CanFit(x, y, z, 16, false, true, false))
return false;
LandTile landTile = map.Tiles.GetLandTile(x, y);
if (landTile.Z == z && (TileData.LandTable[landTile.ID & TileData.MaxLandValue].Flags & TileFlag.Wet) != 0)
return true;
StaticTile[] staticTiles = map.Tiles.GetStaticTiles(x, y, true);
for (int i = 0; i < staticTiles.Length; ++i)
{
StaticTile staticTile = staticTiles[i];
if (staticTile.Z == z && (TileData.ItemTable[staticTile.ID & TileData.MaxItemValue].Flags & TileFlag.Wet) != 0)
return true;
}
return false;
}
示例15: CouldFit
public static AddonFitResult CouldFit( Point3D p, Map map, Mobile from, ref BaseHouse house )
{
if ( !map.CanFit( p.X, p.Y, p.Z, 20, true, true, true ) )
return AddonFitResult.Blocked;
else if ( !BaseAddon.CheckHouse( from, p, map, 20, ref house ) )
return AddonFitResult.NotInHouse;
else
return CheckDoors( p, 20, house );
}