当前位置: 首页>>代码示例>>C#>>正文


C# Map.GetSector方法代码示例

本文整理汇总了C#中Map.GetSector方法的典型用法代码示例。如果您正苦于以下问题:C# Map.GetSector方法的具体用法?C# Map.GetSector怎么用?C# Map.GetSector使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Map的用法示例。


在下文中一共展示了Map.GetSector方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CheckMulti

		public static bool CheckMulti( Point3D p, Map map, bool houses, int housingrange )
		{
			if( map == null || map == Map.Internal )
				return false;

			Sector sector = map.GetSector( p.X, p.Y );

			for( int i = 0; i < sector.Multis.Count; ++i )
			{
				BaseMulti multi = sector.Multis[i];

				if( multi is BaseHouse )
				{
					BaseHouse bh = (BaseHouse)multi;

					if( ( houses && bh.IsInside( p, 16 ) ) || ( housingrange > 0 && bh.InRange( p, housingrange ) ) )
						return true;
				}
				else if( multi.Contains( p ))
				{
					return true;
				}
			}

			return false;
		}
开发者ID:Grimoric,项目名称:RunUO.T2A,代码行数:26,代码来源:SpellHelper.cs

示例2: FindBoatAt

        public static BaseBoat FindBoatAt( IPoint2D loc, Map map )
        {
            Sector sector = map.GetSector(loc);

            for( int i = 0; i < sector.Multis.Count; i++ )
            {
                BaseBoat boat = sector.Multis[i] as BaseBoat;

                if( boat != null && boat.Contains(loc.X, loc.Y) )
                    return boat;
            }

            return null;
        }
开发者ID:greeduomacro,项目名称:hubroot,代码行数:14,代码来源:BaseBoat.cs

示例3: FindMultiAt

		public static BaseMulti FindMultiAt(IPoint2D loc, Map map)
		{
			Sector sector = map.GetSector(loc);

			for (int i = 0; i < sector.Multis.Count; i++)
			{
				BaseMulti multi = sector.Multis[i];

				if (multi != null && multi.Contains(loc.X, loc.Y))
				{
					return multi;
				}
			}

			return null;
		}
开发者ID:rokann,项目名称:JustUO,代码行数:16,代码来源:BaseMulti.cs

示例4: CheckAltar

        public static bool CheckAltar(Point3D p, Map map)
        {
            if (map == null || map == Map.Internal)
                return false;

            Sector sector = map.GetSector(p.X, p.Y);

            for (int i = 0; i < sector.Items.Count; ++i)
            {
                Item item = sector.Items[i];

                if (item is AbbatoirAddon)
                {
                    return true;
                }
            }

            return false;
        }
开发者ID:greeduomacro,项目名称:hubroot,代码行数:19,代码来源:Mark.cs

示例5: CheckMulti

        public static bool CheckMulti( Point3D p, Map map, bool houses )
        {
            if ( map == null || map == Map.Internal )
                return false;

            Sector sector = map.GetSector( p.X, p.Y );

            for ( int i = 0; i < sector.Multis.Count; ++i )
            {
                BaseMulti multi = (BaseMulti) sector.Multis[i];

                if ( multi is BaseHouse )
                {
                    if ( houses && ( (BaseHouse) multi ).IsInside( p, 16 ) )
                        return true;
                }
                else if ( multi.Contains( p ) )
                {
                    return true;
                }
            }

            return false;
        }
开发者ID:justdanofficial,项目名称:khaeros,代码行数:24,代码来源:SpellHelper.cs

示例6: FindHouseAt

        public static BaseHouse FindHouseAt(Point3D loc, Map map, int height)
        {
            if (map == null || map == Map.Internal)
                return null;

            Sector sector = map.GetSector(loc);

            for (int i = 0; i < sector.Multis.Count; ++i)
            {
                BaseHouse house = sector.Multis[i] as BaseHouse;

                if (house != null && house.IsInside(loc, height))
                    return house;
            }

            return null;
        }
开发者ID:Crylian,项目名称:ServUO,代码行数:17,代码来源:BaseHouse.cs

示例7: CheckMulti

        public static bool CheckMulti( Point3D p, Map map, bool houses )
        {
            if( map == null || map == Map.Internal )
                return false;

            Sector sector = map.GetSector( p.X, p.Y );

            for( int i = 0; i < sector.Multis.Count; ++i )
            {
                BaseMulti multi = sector.Multis[i];

                BaseBoat boat = BaseBoat.FindBoatAt(p, map);

                if (boat != null)
                    return true;

                if (multi is BaseHouse && !(((BaseHouse)multi) is GreenTent || ((BaseHouse)multi) is BlueTent))
                {
                    if( houses && ((BaseHouse)multi).IsInside( p, 16 ) )
                        return true;
                }
                else if (multi.Contains(p) && (multi is BaseHouse && !(((BaseHouse)multi) is GreenTent || ((BaseHouse)multi) is BlueTent)))
                {
                    return true;
                }
            }

            return false;
        }
开发者ID:Godkong,项目名称:Origins,代码行数:29,代码来源:SpellHelper.cs

示例8: FindAll

		public static ArrayList FindAll(Point3D p, Map map)
		{
			ArrayList all = new ArrayList();

			if (map == null)
				return all;

			Sector sector = map.GetSector(p);

			foreach (BaseMulti mult in sector.Multis.Values)
			{
				if (mult == null)
					continue;

				if (mult.Contains(p) || mult.Inside(p.X, p.Y))
					all.Add(mult);
			}

			return all;
		}
开发者ID:zerodowned,项目名称:angelisland,代码行数:20,代码来源:BaseMulti.cs

示例9: FindHouseAt

        public static IHouse FindHouseAt( Point3D loc, Map map, int height )
        {
            if ( map == null || map == Map.Internal )
                return null;

            Sector sector = map.GetSector( loc );

            return sector.Multis.OfType<BaseHouse>().FirstOrDefault( h => h.IsInside( loc, height ) );
        }
开发者ID:Ravenwolfe,项目名称:xrunuo,代码行数:9,代码来源:HousingHelper.cs

示例10: CANFITMOB


//.........这里部分代码省略.........

				if (!impassable && z == avgZ && !lt.Ignored)
				{
					hasSurface = true;
				}

				var staticTiles = map.Tiles.GetStaticTiles(x, y, true);

				foreach (StaticTile t in staticTiles)
				{
					ItemData id = TileData.ItemTable[t.ID & TileData.MaxItemValue];
					surface = id.Surface;
					impassable = id.Impassable;

					if (checkmob)
					{
						wet = (id.Flags & TileFlag.Wet) != 0;

						// dont allow wateronly creatures on land
						if (cantwalk && !wet)
						{
							impassable = true;
						}

						// allow water creatures on water
						if (canswim && wet)
						{
							surface = true;
							impassable = false;
						}
					}

					if ((surface || impassable) && (t.Z + id.CalcHeight) > z && (z + height) > t.Z)
					{
						return false;
					}

					if (surface && !impassable && z == (t.Z + id.CalcHeight))
					{
						hasSurface = true;
					}
				}

				Sector sector = map.GetSector(x, y);
				var items = sector.Items;
				var mobs = sector.Mobiles;

				foreach (Item item in items)
				{
					if (item.ItemID >= 0x4000 || !item.AtWorldPoint(x, y))
					{
						continue;
					}

					ItemData id = item.ItemData;
					surface = id.Surface;
					impassable = id.Impassable;

					if (checkmob)
					{
						wet = (id.Flags & TileFlag.Wet) != 0;

						// dont allow wateronly creatures on land
						if (cantwalk && !wet)
						{
							impassable = true;
						}

						// allow water creatures on water
						if (canswim && wet)
						{
							surface = true;
							impassable = false;
						}
					}

					if ((surface || impassable || (checkBlocksFit && item.BlocksFit)) && (item.Z + id.CalcHeight) > z &&
						(z + height) > item.Z)
					{
						return false;
					}

					if (surface && !impassable && !item.Movable && z == (item.Z + id.CalcHeight))
					{
						hasSurface = true;
					}
				}

				if (checkMobiles)
				{
					if (
						mobs.Where(m => m.Location.X == x && m.Location.Y == y && (m.AccessLevel == AccessLevel.Player || !m.Hidden))
							.Any(m => (m.Z + 16) > z && (z + height) > m.Z))
					{
						return false;
					}
				}

				return !requireSurface || hasSurface;
			}
开发者ID:greeduomacro,项目名称:UO-Forever,代码行数:101,代码来源:UberScriptFunctions.cs

示例11: CheckMovement

        public bool CheckMovement(Mobile m, Map map, Point3D loc, Direction d, out int newZ)
        {
            if (map == null || map == Map.Internal)
            {
                newZ = 0;
                return false;
            }

            int xStart = loc.X;
            int yStart = loc.Y;
            int xForward = xStart, yForward = yStart;
            int xRight = xStart, yRight = yStart;
            int xLeft = xStart, yLeft = yStart;

            bool checkDiagonals = ((int)d & 0x1) == 0x1;

            this.Offset(d, ref xForward, ref yForward);
            this.Offset((Direction)(((int)d - 1) & 0x7), ref xLeft, ref yLeft);
            this.Offset((Direction)(((int)d + 1) & 0x7), ref xRight, ref yRight);

            if (xForward < 0 || yForward < 0 || xForward >= map.Width || yForward >= map.Height)
            {
                newZ = 0;
                return false;
            }

            int startZ, startTop;

            List<Item> itemsStart = this.m_Pools[0];
            List<Item> itemsForward = this.m_Pools[1];
            List<Item> itemsLeft = this.m_Pools[2];
            List<Item> itemsRight = this.m_Pools[3];

            bool ignoreMovableImpassables = m_IgnoreMovableImpassables;
            TileFlag reqFlags = ImpassableSurface;

            if (m.CanSwim)
                reqFlags |= TileFlag.Wet;

            List<Mobile> mobsForward = this.m_MobPools[0];
            List<Mobile> mobsLeft = this.m_MobPools[1];
            List<Mobile> mobsRight = this.m_MobPools[2];

            bool checkMobs = (m is BaseCreature && !((BaseCreature)m).Controlled && (xForward != m_Goal.X || yForward != m_Goal.Y));

            if (checkDiagonals)
            {
                Sector sectorStart = map.GetSector(xStart, yStart);
                Sector sectorForward = map.GetSector(xForward, yForward);
                Sector sectorLeft = map.GetSector(xLeft, yLeft);
                Sector sectorRight = map.GetSector(xRight, yRight);

                List<Sector> sectors = this.m_Sectors;

                sectors.Add(sectorStart);

                if (!sectors.Contains(sectorForward))
                    sectors.Add(sectorForward);

                if (!sectors.Contains(sectorLeft))
                    sectors.Add(sectorLeft);

                if (!sectors.Contains(sectorRight))
                    sectors.Add(sectorRight);

                for (int i = 0; i < sectors.Count; ++i)
                {
                    Sector sector = sectors[i];

                    for (int j = 0; j < sector.Items.Count; ++j)
                    {
                        Item item = sector.Items[j];

                        if (ignoreMovableImpassables && item.Movable && (item.ItemData.Flags & ImpassableSurface) != 0)
                            continue;

                        if ((item.ItemData.Flags & reqFlags) == 0)
                            continue;

                        if (sector == sectorStart && item.AtWorldPoint(xStart, yStart) && !(item is BaseMulti) && item.ItemID <= TileData.MaxItemValue)
                            itemsStart.Add(item);
                        else if (sector == sectorForward && item.AtWorldPoint(xForward, yForward) && !(item is BaseMulti) && item.ItemID <= TileData.MaxItemValue)
                            itemsForward.Add(item);
                        else if (sector == sectorLeft && item.AtWorldPoint(xLeft, yLeft) && !(item is BaseMulti) && item.ItemID <= TileData.MaxItemValue)
                            itemsLeft.Add(item);
                        else if (sector == sectorRight && item.AtWorldPoint(xRight, yRight) && !(item is BaseMulti) && item.ItemID <= TileData.MaxItemValue)
                            itemsRight.Add(item);
                    }

                    if (checkMobs)
                    {
                        for (int j = 0; j < sector.Mobiles.Count; ++j)
                        {
                            Mobile mob = sector.Mobiles[j];

                            if (sector == sectorForward && mob.X == xForward && mob.Y == yForward)
                                mobsForward.Add(mob);
                            else if (sector == sectorLeft && mob.X == xLeft && mob.Y == yLeft)
                                mobsLeft.Add(mob);
                            else if (sector == sectorRight && mob.X == xRight && mob.Y == yRight)
//.........这里部分代码省略.........
开发者ID:Crome696,项目名称:ServUO,代码行数:101,代码来源:Movement.cs

示例12: FindGalleonAt

        public static BaseGalleon FindGalleonAt(IPoint2D loc, Map map)
        {
            Sector sector = map.GetSector(loc);

            for (int i = 0; i < sector.Multis.Count; i++)
            {
                BaseGalleon galleon = sector.Multis[i] as BaseGalleon;

                if (galleon != null && galleon.Contains(loc.X, loc.Y))
                    return galleon;
            }

            return null;
        }		
开发者ID:greeduomacro,项目名称:UO-Forever,代码行数:14,代码来源:BaseGalleon.cs

示例13: CheckMovement

		public bool CheckMovement(Mobile m, Map map, Point3D loc, Direction d, out int newZ)
		{
			if (!Enabled && _Successor != null)
			{
				return _Successor.CheckMovement(m, map, loc, d, out newZ);
			}

			if (map == null || map == Map.Internal)
			{
				newZ = 0;
				return false;
			}

			var xStart = loc.X;
			var yStart = loc.Y;

			int xForward = xStart, yForward = yStart;
			int xRight = xStart, yRight = yStart;
			int xLeft = xStart, yLeft = yStart;

			var checkDiagonals = ((int)d & 0x1) == 0x1;

			Offset(d, ref xForward, ref yForward);
			Offset((Direction)(((int)d - 1) & 0x7), ref xLeft, ref yLeft);
			Offset((Direction)(((int)d + 1) & 0x7), ref xRight, ref yRight);

			if (xForward < 0 || yForward < 0 || xForward >= map.Width || yForward >= map.Height)
			{
				newZ = 0;
				return false;
			}

			int startZ, startTop;

			IEnumerable<Item> itemsStart, itemsForward, itemsLeft, itemsRight;

			var ignoreMovableImpassables = MovementImpl.IgnoreMovableImpassables;
			var reqFlags = ImpassableSurface;

			if (m.CanSwim)
			{
				reqFlags |= TileFlag.Wet;
			}

			if (checkDiagonals)
			{
				var sStart = map.GetSector(xStart, yStart);
				var sForward = map.GetSector(xForward, yForward);
				var sLeft = map.GetSector(xLeft, yLeft);
				var sRight = map.GetSector(xRight, yRight);

				itemsStart = sStart.Items.Where(i => Verify(i, reqFlags, ignoreMovableImpassables, xStart, yStart));
				itemsForward = sForward.Items.Where(i => Verify(i, reqFlags, ignoreMovableImpassables, xForward, yForward));
				itemsLeft = sLeft.Items.Where(i => Verify(i, reqFlags, ignoreMovableImpassables, xLeft, yLeft));
				itemsRight = sRight.Items.Where(i => Verify(i, reqFlags, ignoreMovableImpassables, xRight, yRight));
			}
			else
			{
				var sStart = map.GetSector(xStart, yStart);
				var sForward = map.GetSector(xForward, yForward);

				itemsStart = sStart.Items.Where(i => Verify(i, reqFlags, ignoreMovableImpassables, xStart, yStart));
				itemsForward = sForward.Items.Where(i => Verify(i, reqFlags, ignoreMovableImpassables, xForward, yForward));
				itemsLeft = Enumerable.Empty<Item>();
				itemsRight = Enumerable.Empty<Item>();
			}

			GetStartZ(m, map, loc, itemsStart, out startZ, out startTop);

			List<Item> list = null;

			MovementPool.AcquireMoveCache(ref list, itemsForward);

			var moveIsOk = Check(map, m, list, xForward, yForward, startTop, startZ, m.CanSwim, m.CantWalk, out newZ);

			if (moveIsOk && checkDiagonals)
			{
				int hold;

				if (m.Player && m.AccessLevel < AccessLevel.GameMaster)
				{
					MovementPool.AcquireMoveCache(ref list, itemsLeft);

					if (!Check(map, m, list, xLeft, yLeft, startTop, startZ, m.CanSwim, m.CantWalk, out hold))
					{
						moveIsOk = false;
					}
					else
					{
						MovementPool.AcquireMoveCache(ref list, itemsRight);

						if (!Check(map, m, list, xRight, yRight, startTop, startZ, m.CanSwim, m.CantWalk, out hold))
						{
							moveIsOk = false;
						}
					}
				}
				else
				{
					MovementPool.AcquireMoveCache(ref list, itemsLeft);
//.........这里部分代码省略.........
开发者ID:greeduomacro,项目名称:last-wish,代码行数:101,代码来源:FastMovement.cs

示例14: TryInitialise

        private void TryInitialise()
        {
            if (!this.m_initialised
                && this.Map != Map.Internal
                && this.Location != Point3D.Zero)
            {
                this.m_initialised = true;
                BaseHouse house = (BaseHouse.FindHouseAt((BaseAddon)this));
                m_House = house;
                n_Map = ((BaseAddon)this).Map;
                CellarDeed2 gt = (CellarDeed2)Deed;
                Point3D hsp = new Point3D(this.X, this.Y, this.Z);
                Sector s = n_Map.GetSector(hsp);
                int houseYOffset = this.Y - house.Y;
                int houseXOffset = this.X - house.X;
                int type = (int)gt.m_LandType;

                if (null != house.Area
                    && house.Area.Length > 0)
                {
                    //Find the minimum z value, so we can ensure it is all underground.
                    int minz = 150;
                    for (int i = 0; i < house.Area.Length; ++i)
                    {
                        Rectangle2D area = house.Area[i];
                        int width = area.Width;
                        int height = area.Height;
                        for (int rx = 0; rx < width; ++rx)
                        {
                            for (int ry = 0; ry < height; ++ry)
                            {
                                int vx = rx + area.X - houseXOffset;
                                int vy = ry + area.Y - houseYOffset;
                                minz = Math.Min(n_Map.GetAverageZ(vx, vy) - 40, minz);
                            }
                        }
                    }

                    minz = minz - this.Z;
                    //Place components
                    for (int i = 0; i < house.Area.Length; ++i)
                    {
                        Rectangle2D area = house.Area[i];
                        int width = area.Width;
                        int height = area.Height;
                        for (int rx = 0; rx < width; ++rx)
                        {
                            for (int ry = 0; ry < height; ++ry)
                            {
                                int vx = rx + area.X - houseXOffset;
                                int vy = ry + area.Y - houseYOffset;

                                AddComponent(new AddonComponent(type), vx, vy, minz);
                            }
                        }
                    }

                    this.m_topTeleporter.ZOffset = minz;
                    AddComponent(new CellarTeleporter4(-minz), 0, 0, minz);
                }
            }
        }
开发者ID:Tukaramdas,项目名称:ServUO-EC-Test-Fork,代码行数:62,代码来源:CellarAddon.cs

示例15: CheckFit

        private bool CheckFit( Map map, Point3D p, int height )
        {
            if ( map == Map.Internal )
                return false;

            int x = p.X;
            int y = p.Y;
            int z = p.Z;

            Sector sector = map.GetSector( x, y );
            List<Item> items  = sector.Items;
            List<Mobile> mobs = sector.Mobiles;

            for ( int i = 0; i < items.Count; ++i )
            {
                Item item = items[i];

                if ( item.ItemID < 0x4000 && item.AtWorldPoint( x, y ) && !(item is BaseDoor) )
                {
                    ItemData id = item.ItemData;
                    bool surface = id.Surface;
                    bool impassable = id.Impassable;

                    if ( (surface || impassable) && (item.Z + id.CalcHeight) > z && (z + height) > item.Z )
                        return false;
                }
            }

            for ( int i = 0; i < mobs.Count; ++i )
            {
                Mobile m = mobs[i];

                if ( m.Location.X == x && m.Location.Y == y )
                {
                    if ( m.Hidden && m.AccessLevel > AccessLevel.Player )
                        continue;

                    if ( !m.Alive )
                        continue;

                    if ( (m.Z + 16) > z && (z + height) > m.Z )
                        return false;
                }
            }

            return true;
        }
开发者ID:Godkong,项目名称:RunUO,代码行数:47,代码来源:BaseDoor.cs


注:本文中的Map.GetSector方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。