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


C# Map.GetObjectsInRange方法代码示例

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


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

示例1: Explode

		public void Explode( Mobile from, bool direct, Point3D loc, Map map )
		{
			if ( Deleted )
				return;

            if (from != null)
            {
                CustomRegion cR = from.Region as CustomRegion;
                CustomRegion cR2 = Region.Find(loc, map) as CustomRegion;

                if ((cR != null && !cR.Controller.CanUsePotExplosion) || (cR2 != null && !cR2.Controller.CanUsePotExplosion))
                    return;
            }
            else
            {
                CustomRegion cR = Region.Find(loc, map) as CustomRegion;

                if ((cR != null && !cR.Controller.CanUsePotExplosion))
                    return;
            }

		    if (!EventItem || (EventItem && EventItemConsume))
                Consume();
            else
            {
                Mobile m;
                if (m_Users != null && m_Users[0] is Mobile)
                    m = (Mobile)m_Users[0];
                else
                    m = from;

                if (m != null && RootParentEntity != m)
                    m.AddToBackpack(this);

                m_Timer = null;
            }

		    for ( int i = 0; m_Users != null && i < m_Users.Count; ++i )
			{
				Mobile m = (Mobile)m_Users[i];
				ThrowTarget targ = m.Target as ThrowTarget;

				if ( targ != null && targ.Potion == this )
					Target.Cancel( m );
			}

			if ( map == null )
				return;

			Effects.PlaySound( loc, map, 0x207 );
			Effects.SendLocationEffect( loc, map, 0x36BD, 20 );

			int alchemyBonus = 0;

            if (direct && from != null)
			    alchemyBonus = (int)(from.Skills.Alchemy.Value / (Core.AOS ? 5 : 10));

			IPooledEnumerable eable = LeveledExplosion ? map.GetObjectsInRange( loc, ExplosionRange ) : map.GetMobilesInRange( loc, ExplosionRange );
			ArrayList toExplode = new ArrayList();

			int toDamage = 0;

			foreach ( object o in eable )
			{
				if ( o is Mobile )
				{
					toExplode.Add( o );
					++toDamage;
				}
				else if ( o is BaseExplosionPotion && o != this )
				{
					toExplode.Add( o );
				}
			}

			eable.Free();

			int min = Scale( from, MinDamage );
			int max = Scale( from, MaxDamage );
		    int count = 1;

			for ( int i = 0; i < toExplode.Count; ++i )
			{
				object o = toExplode[i];

				if ( o is Mobile )
				{
				    Mobile m = (Mobile)o;
                    GuardedRegion reg = (GuardedRegion)Region.Find(m.Location, m.Map).GetRegion(typeof(GuardedRegion));

                    //Taran: Don't hurt mobiles in guarded
                    if (reg == null || reg.Disabled)
                    {
                        if (from != null && from.CanBeHarmful(m, false))
                        {
                            from.DoHarmful(m);

                            int damage = Utility.RandomMinMax(min, max);

                            damage += alchemyBonus;
//.........这里部分代码省略.........
开发者ID:FreeReign,项目名称:imaginenation,代码行数:101,代码来源:BaseExplosionPotion.cs

示例2: IsThereVendor

        public static void IsThereVendor(Point3D location, Map map, out bool vendor, out bool rentalContract)
        {
            vendor = false;
            rentalContract = false;

            IPooledEnumerable eable = map.GetObjectsInRange(location, 0);

            foreach (IEntity entity in eable)
            {
                if (Math.Abs(location.Z - entity.Z) <= 16)
                {
                    if (entity is PlayerVendor || entity is PlayerBarkeeper || entity is PlayerVendorPlaceholder)
                    {
                        vendor = true;
                        break;
                    }

                    if (entity is VendorRentalContract)
                    {
                        rentalContract = true;
                        break;
                    }
                }
            }

            eable.Free();
        }
开发者ID:Crylian,项目名称:ServUO,代码行数:27,代码来源:BaseHouse.cs

示例3: Explode

		public void Explode(Mobile from, bool direct, Point3D loc, Map map)
		{
			if (Deleted)
			{
				return;
			}

			Consume();

			for (int i = 0; m_Users != null && i < m_Users.Count; ++i)
			{
				Mobile m = (Mobile)m_Users[i];
				ThrowTarget targ = m.Target as ThrowTarget;

				if (targ != null && targ.Potion == this)
				{
					Target.Cancel(m);
				}
			}

			if (map == null)
			{
				return;
			}

			Effects.PlaySound(loc, map, 0x307);

			Effects.SendLocationEffect(loc, map, 0x36B0, 9, 10, 0, 0);
			int alchemyBonus = 0;

			if (direct)
			{
				alchemyBonus = (int)(from.Skills.Alchemy.Value / (Core.AOS ? 5 : 10));
			}

			IPooledEnumerable eable = LeveledExplosion
										  ? map.GetObjectsInRange(loc, ExplosionRange)
										  : (IPooledEnumerable)map.GetMobilesInRange(loc, ExplosionRange);
			ArrayList toExplode = new ArrayList();

			int toDamage = 0;

			foreach (object o in eable)
			{
				if (o is Mobile &&
					(from == null || (SpellHelper.ValidIndirectTarget(from, (Mobile)o) && from.CanBeHarmful((Mobile)o, false))))
				{
					toExplode.Add(o);
					++toDamage;
				}
				else if (o is BaseExplosionPotion && o != this)
				{
					toExplode.Add(o);
				}
			}

			eable.Free();

			int min = Scale(from, MinDamage);
			int max = Scale(from, MaxDamage);

			for (int i = 0; i < toExplode.Count; ++i)
			{
				object o = toExplode[i];

				if (o is Mobile)
				{
					Mobile m = (Mobile)o;

					if (from != null)
					{
						from.DoHarmful(m);
					}

					int damage = Utility.RandomMinMax(min, max);

					damage += alchemyBonus;

					if (!Core.AOS && damage > 40)
					{
						damage = 40;
					}
					else if (Core.AOS && toDamage > 2)
					{
						damage /= toDamage - 1;
					}

					AOS.Damage(m, from, damage, 0, 100, 0, 0, 0);
				}
				else if (o is BaseExplosionPotion)
				{
					BaseExplosionPotion pot = (BaseExplosionPotion)o;

					pot.Explode(from, false, pot.GetWorldLocation(), pot.Map);
				}
			}
		}
开发者ID:aj9251,项目名称:ServUO,代码行数:97,代码来源:BaseExplosionPotion.cs

示例4: IsThereVendor

		public static void IsThereVendor( Point3D location, Map map, out bool vendor )
		{
			vendor = false;

			IPooledEnumerable eable = map.GetObjectsInRange( location, 0 );

			foreach ( IEntity entity in eable )
			{
				if ( Math.Abs( location.Z - entity.Z ) <= 16 )
				{
					if ( entity is PlayerVendor )
					{
						vendor = true;
						break;
					}
				}
			}

			eable.Free();
		}
开发者ID:Grimoric,项目名称:RunUO.T2A,代码行数:20,代码来源:BaseHouse.cs

示例5: GETNEARBYOBJS

			public static ArrayList GETNEARBYOBJS(TriggerObject trigObject, IPoint3D from, int range, Map map)
			{
				var enumerator = map.GetObjectsInRange(new Point3D(from), range);

				ArrayList output = new ArrayList(50);

				foreach (IEntity nearby in enumerator)
				{
					output.Add(nearby);
				}

				enumerator.Free();
				return output;
			}
开发者ID:greeduomacro,项目名称:UO-Forever,代码行数:14,代码来源:UberScriptFunctions.cs

示例6: Explode

		public void Explode(Mobile from, bool direct, Point3D loc, Map map)
		{
			if (Deleted)
			{
				return;
			}

			for (int i = 0; m_Users != null && i < m_Users.Count; ++i)
			{
				Mobile m = m_Users[i];
				var targ = m.Target as ThrowTarget;

				if (targ != null && targ.Potion == this)
				{
					Targeting.Target.Cancel(m);
				}
			}

			Consume();

			if (map == null)
			{
				return;
			}

			Effects.PlaySound(loc, map, 0x307);
			Effects.SendLocationEffect(loc, map, 0x36BD, 9, 10, 0, 0);

			int alchemyBonus = 0;

			if (direct)
			{
				alchemyBonus = (int)(from.Skills.Alchemy.Value * ExplosionPotionController._AlchemyBonusPercentageOfSkill * 0.01);
			}
			if (alchemyBonus > ExplosionPotionController._AlchemyBonusMax)
			{
				alchemyBonus = ExplosionPotionController._AlchemyBonusMax;
			}

			IPooledEnumerable eable = LeveledExplosion
										  ? map.GetObjectsInRange(loc, ExplosionRange)
										  : map.GetMobilesInRange(loc, ExplosionRange);
			var toExplode = new ArrayList();

			int toDamage = 0;

			foreach (IEntity o in eable)
			{
				if (o is Mobile &&
					(from == null || (SpellHelper.ValidIndirectTarget(from, (Mobile)o) && from.CanBeHarmful((Mobile)o, false))))
				{
					toExplode.Add(o);
					++toDamage;
				}
				else if (o is BaseExplosionPotion && o != this)
				{
					toExplode.Add(o);
				}
			}

			eable.Free();

			//			int min = Scale( from, MinDamage );
			//			int max = Scale( from, MaxDamage );

			for (int i = 0; i < toExplode.Count; ++i)
			{
				object o = toExplode[i];

				if (o is Mobile)
				{
					var m = (Mobile)o;

					if (from != null)
					{
						from.DoHarmful(m);

						double damage = Scale(from, Damage);

						damage += alchemyBonus;

						if (damage > 30)
						{
							damage = 15;
						}

						if (toDamage > 2)
						{
							damage /= toDamage - 1;
						}

						if (m is BaseCreature && !((BaseCreature)m).TakesNormalDamage)
						{
							damage *= 1.4;
						}

						var iDamage = (int)damage;
						if ((XmlScript.HasTrigger(from, TriggerName.onGivenHit) &&
							 UberScriptTriggers.Trigger(from, m, TriggerName.onGivenHit, this, null, null, iDamage)) ||
							(XmlScript.HasTrigger(m, TriggerName.onTakenHit) &&
//.........这里部分代码省略.........
开发者ID:greeduomacro,项目名称:UO-Forever,代码行数:101,代码来源:BaseExplosionPotion.cs

示例7: Explode


//.........这里部分代码省略.........
                                    MinDamage = m_TargetItemMinDamage,
                                    MaxDamage = m_TargetItemMaxDamage,
                                    Location = new Point3D(p.X, p.Y, loc.Z + 2),
                                    Map = Map
                                };
                        }
                        if (m_MoveOnUse)
                            Location = new Point3D(X, Y, loc.Z + 2);
                    }
                    else
                    {
                        PublicOverheadMessage(MessageType.Regular, 0x3B2, true, "Too big blast radius to create target items");
                        return;
                    }

                    effects.Clear();
                }
                else
                {
                    new ThrowableItemTargetItem(m_TargetItemDuration, m_TargetItemID)
                    {
                        Name = m_TargetItemName,
                        Hue = m_TargetItemHue,
                        MinDamage = m_TargetItemMinDamage,
                        MaxDamage = m_TargetItemMaxDamage,
                        Location = loc,
                        Map = Map
                    };
                }

                
            }

            IPooledEnumerable eable = m_DetonateNearby ? map.GetObjectsInRange(loc, BlastRadius) : map.GetMobilesInRange(loc, BlastRadius);
            ArrayList toExplode = new ArrayList();

            foreach (object o in eable)
            {
                if (o is Mobile)
                {
                    toExplode.Add(o);
                }
                else if (o is ThrowableItem && o != this)
                {
                    toExplode.Add(o);
                }
            }

            eable.Free();

            int min = m_MinDamage;
            int max = m_MaxDamage;

            for (int i = 0; i < toExplode.Count; ++i)
            {
                object o = toExplode[i];

                if (o is Mobile)
                {
                    Mobile m = (Mobile)o;

                    if (m_MaxDamage > 0)
                    {
                        GuardedRegion reg = (GuardedRegion)Region.Find(m.Location, m.Map).GetRegion(typeof(GuardedRegion));

                        if (m_CheckGuarded && reg != null && !reg.Disabled)
开发者ID:FreeReign,项目名称:imaginenation,代码行数:67,代码来源:ThrowableItem.cs


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