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


C# Mobile.InRange方法代码示例

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


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

示例1: OnDoubleClick

		public override void OnDoubleClick( Mobile from )
		{
			if ( !from.InRange( this.GetWorldLocation(), 2 ) || !from.InLOS( this ) )
			{
				from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 1019045 ); // I can't reach that
			}
			else if ( Visible && ( ItemID == 4656 || ItemID == 4702 ) && DateTime.Now >= m_NextUse )
			{
				Point3D p = this.GetWorldLocation();

				if ( 1 > Utility.Random( Math.Max( Math.Abs( from.X - p.X ), Math.Abs( from.Y - p.Y ) ) ) )
				{
					Effects.PlaySound( from.Location, from.Map, from.GetHurtSound() );
					from.PublicOverheadMessage( MessageType.Regular, from.SpeechHue, true, "Ouch!" );
					Spells.SpellHelper.Damage( TimeSpan.FromSeconds( 0.5 ), from, Utility.Dice( 2, 10, 5 ) );
				}

				Effects.PlaySound( this.GetWorldLocation(), this.Map, 0x387 );

				Timer.DelayCall( TimeSpan.FromSeconds( 0.25 ), new TimerCallback( Down1 ) );
				Timer.DelayCall( TimeSpan.FromSeconds( 0.50 ), new TimerCallback( Down2 ) );

				Timer.DelayCall( TimeSpan.FromSeconds( 5.00 ), new TimerCallback( BackUp ) );

				m_NextUse = DateTime.Now + TimeSpan.FromSeconds( 10.0 );
			}
		}
开发者ID:romeov007,项目名称:imagine-uo,代码行数:27,代码来源:Guillotine.cs

示例2: OnTarget

 protected override void OnTarget( Mobile from, object targeted )
 {
    if ( targeted is BaseWeapon )
    {
       BaseWeapon Weapon = targeted as BaseWeapon;
       if ( !from.InRange( m_LTub.GetWorldLocation(), 1 ) || !from.InRange( ((Item)targeted).GetWorldLocation(), 1 ) )
       {
          from.SendLocalizedMessage( 500446 ); // That is too far away.
       }
       else if (( ((Item)targeted).Parent != null ) && ( ((Item)targeted).Parent is Mobile ) )
       {
          from.SendMessage( "You cannot dye that in it's current location." );
       }
       else if ( Weapon.Type == WeaponType.Polearm || Weapon.Type == WeaponType.Piercing
       || Weapon.Type == WeaponType.Staff || Weapon.Type == WeaponType.Staff || Weapon.Type == WeaponType.Slashing
       || Weapon.Type == WeaponType.Bashing || Weapon.Type == WeaponType.Axe || Weapon.Type == WeaponType.Ranged )
       {
          Weapon.Hue = m_LTub.Hue;
          from.PlaySound( 0x23E );
       }
    }
    else if ( targeted is BaseLeather )
    {
       from.SendLocalizedMessage( 1042083 ); // You can not dye that.
    }
 }
开发者ID:kamronbatman,项目名称:DefianceUO-Pre1.10,代码行数:26,代码来源:WeaponDyeTub.cs

示例3: OnDoubleClick

        // When this object -- the bottle -- is double-clicked...
        public override void OnDoubleClick(Mobile m)
        {
            if (m.Followers >= m.FollowersMax) // If the player's followers is greater than or equal to his max followers...
            {
                m.SendMessage("You need at least one free follower slot to open the bottle.");
            }
            else if (((m.InRange(this, 1) && m.CanSee(this)) || this.IsChildOf(m.Backpack)) && (!GetGooInBottle())) // If the bottle is in-range and the goo is not in its bottle...
            {
                m.SendMessage("The goo is out of its bottle!");
                m.SendLocalizedMessage(1010018); // What do you want to use this item on?

                m.Target = new BottleOfGooTarget(this, gooPet); // Creates a target from this mobile with the goo mobile thrown to the new class as a reference.
            }
            else if (((m.InRange(this, 1) && m.CanSee(this)) || this.IsChildOf(m.Backpack)) && (GetGooInBottle())) // If the bottle is in-range and the goo IS in its bottle, this function creates a new goo mobile.
            {
                gooPet = new Goo(this);

                ((GenericWarrior)gooPet).Controlled = true;
                ((GenericWarrior)gooPet).ControlMaster = m;

                gooPet.MoveToWorld(m.Location, m.Map);
                gooPet.PlaySound(0x1CC);
                gooPet.Emote("*leaps out of " + m.Name + "'s bottle!*");

                SetGooInBottle(false);
            }
            else
            {
                m.SendLocalizedMessage(500446); //That is too far away.
            }
        }
开发者ID:justdanofficial,项目名称:khaeros,代码行数:32,代码来源:BottleOfGoo.cs

示例4: OnDoubleClick

		public virtual void OnDoubleClick( Mobile from, bool createWeedsAndDelete )
		{
			if( !from.CanSee( this ) )
			{
				from.SendMessage( "You cannot see that." );
			}
			else if( !(this is HarvestableTree) && !from.InRange( this, 1 ) )
			{
				from.SendLocalizedMessage( CommonLocs.YouTooFar );
			}
			else if( this is HarvestableTree && !from.InRange( this, 2 ) )
			{
				from.SendLocalizedMessage( CommonLocs.YouTooFar );
			}
			else if( (Sower != null && from != m_Sower) && !(this is HarvestableTree) )
			{
				from.SendMessage( "You cannot harvest any of this crop." );
			}
			else if( from.Mounted )
			{
				from.SendMessage( "You cannot do this while riding a mount." );
			}
			else
			{
				int calcYield = CalculateYield( from );
				Item crop = null;

				try { crop = CreateCrop( calcYield ); }
				catch( Exception e ) { Server.Utilities.ExceptionManager.LogException( "BaseGrownCrop.cs", e ); }

				if( crop == null )
				{
					from.SendMessage( "You are unable to harvest any of this crop!" );
				}
				else
				{
					from.AddToBackpack( crop );

					from.Direction = from.GetDirectionTo( this );
					from.Animate( AnimationFrame, 5, 1, true, false, 0 );
					from.PlaySound( 0x133 );
					from.SendMessage( "You successfully harvest the crop!" );
				}

				if( createWeedsAndDelete )
				{
					new Weeds().MoveToWorld( this.Location, this.Map );
					this.Delete();
				}
				else
				{
					OnHarvest( from );
				}
			}
		}
开发者ID:greeduomacro,项目名称:hubroot,代码行数:55,代码来源:BaseGrownCrop.cs

示例5: OnDoubleClick

 public override void OnDoubleClick(Mobile from)
 {
     if (from.InRange(this.GetWorldLocation(), 1))
     {
         from.SendMessage("You try to examine the strange wall but the vines get in your way.");
     }
     else if (!from.InRange(this.GetWorldLocation(), 1))
     {
         from.SendMessage("I can't reach that.");
     }
     base.OnDoubleClick(from);
 }
开发者ID:greeduomacro,项目名称:cov-shard-svn-1,代码行数:12,代码来源:AcidWall1.cs

示例6: OnDoubleClick

        public override void OnDoubleClick(Mobile from)
        {
            if (from != base.Owner || !base.IncludedEntities.Contains(from))
                from.SendMessage("You are not permitted to board this carpet.");

            if (!from.InRange(this.Location, 1))
                from.SendMessage("You must be closer if you wish to board this.");

            if ((from == base.Owner || base.IncludedEntities.Contains(from))
                && from.InRange(this.Location, 1))
            {
                from.MoveToWorld(this.Location, this.Map);
            }
        }
开发者ID:greeduomacro,项目名称:C-Sharp-For-RunUO,代码行数:14,代码来源:SmallRedCarpet.cs

示例7: OnDoubleClick

        public override void OnDoubleClick( Mobile from )
        {
            Direction dir;
            if ( from.Location != this.Location )
                dir = from.GetDirectionTo( this );
            else if ( this.East )
                dir = Direction.West;
            else
                dir = Direction.North;

            from.Direction = dir;

            bool canThrow = true;

            if ( !from.InRange( this, 4 ) || !from.InLOS( this ) )
                canThrow = false;
            else if ( this.East )
                canThrow = ( dir == Direction.Left || dir == Direction.West || dir == Direction.Up );
            else
                canThrow = ( dir == Direction.Up || dir == Direction.North || dir == Direction.Right );

            if ( canThrow )
                Throw( from );
            else
                from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 1019045 ); // I can't reach that.
        }
开发者ID:kamronbatman,项目名称:Defiance-AOS-Pre-2012,代码行数:26,代码来源:DartBoard.cs

示例8: ValidatePlacement

		public bool ValidatePlacement( Mobile from, Point3D loc )
		{
			if ( from.AccessLevel >= AccessLevel.GameMaster )
				return true;

			if ( !from.InRange( this.GetWorldLocation(), 1 ) )
			{
				from.SendLocalizedMessage( 500446 ); // That is too far away.
				return false;
			}

			Map map = from.Map;

			if ( map == null )
				return false;

			BaseHouse house = BaseHouse.FindHouseAt( loc, map, 20 );

			if ( house != null && !house.IsFriend( from ) )
			{
				from.SendLocalizedMessage(500269); // You cannot build that there.
				return false;
			}

			if ( !map.CanFit( loc, 20 ) )
			{
				from.SendLocalizedMessage( 500269 ); // You cannot build that there.
				return false;
			}

			return true;
		}
开发者ID:ITLongwell,项目名称:aedilis2server,代码行数:32,代码来源:SiegeRamDeed.cs

示例9: OnTarget

        protected void OnTarget( Mobile from, object targeted )
        {
            if ( from.Backpack == null || !IsChildOf( from.Backpack ) )
            {
                from.SendLocalizedMessage( 1080063 ); // This must be in your backpack to use it.
                return;
            }

            if ( targeted is MagicVines )
            {
                MagicVines vines = targeted as MagicVines;

                if ( from.InRange( vines, 1 ) )
                {
                    vines.OnAcidSac( from );
                    Consume();
                }
                else
                {
                    from.SendLocalizedMessage( 1076766 ); // That is too far away.
                }
            }
            else
            {
                from.SendLocalizedMessage( 1046439 ); // That is not a valid target.
            }
        }
开发者ID:Ravenwolfe,项目名称:xrunuo,代码行数:27,代码来源:AcidSac.cs

示例10: OnDoubleClick

        public override void OnDoubleClick( Mobile from )
        {
            if ( this.Parent != null || !this.VerifyMove( from ) )
                return;

            if ( !from.InRange( this, 2 ) )
            {
                from.LocalOverheadMessage( MessageType.Regular, 0x3B2, true, "I can't reach that." ); // I can't reach that.
                return;
            }

            if ( this.ItemID == 0xA57 ) // rolled
            {
                Direction dir = PlayerMobile.GetDirection4( from.Location, this.Location );

                if ( dir == Direction.North || dir == Direction.South )
                    this.ItemID = 0xA55;
                else
                    this.ItemID = 0xA56;
            }
            else // unrolled
            {
                this.ItemID = 0xA57;

                if ( !from.HasGump( typeof( LogoutGump ) ) )
                {
                    CampfireEntry entry = Campfire.GetEntry( from );

                    if ( entry != null && entry.Safe )
                        from.SendGump( new LogoutGump( entry, this ) );
                }
            }
        }
开发者ID:Godkong,项目名称:Origins,代码行数:33,代码来源:Bedroll.cs

示例11: OnComponentUsed

        public override void OnComponentUsed(AddonComponent c, Mobile from)
		{
			if(from.InRange(c.Location, 3) && from.Backpack != null)
			{
				foreach(WispOrb orb in WispOrb.Orbs)
				{
					if(orb.Owner == from)
					{
						LabelTo(from, 1153357); // Thou can guide but one of us.
						return;
					}
				}
				
				Alignment alignment = Alignment.Neutral;
				
				if(from.Karma > 0 && m_Alignment == Alignment.Good)
					alignment = Alignment.Good;
				else if (from.Karma < 0 && m_Alignment == Alignment.Evil)
					alignment = Alignment.Evil;
					
				if(alignment != Alignment.Neutral)
				{
                    WispOrb orb = new WispOrb(from, alignment);
					from.Backpack.DropItem(orb);

                    Timer.DelayCall(TimeSpan.FromSeconds(0.5), new TimerStateCallback(SendMessage_Callback), new object[] { orb, from } );
				}
				else
					LabelTo(from, 1153350); // Thy spirit be not compatible with our goals!
			}
		}
开发者ID:Crome696,项目名称:ServUO,代码行数:31,代码来源:DespiseAnkh.cs

示例12: OnTarget

        protected override void OnTarget( Mobile from, object target )
        {
            if( target is HitchingPost )
            {
                HitchingPost post = (HitchingPost)target;

                if( !from.InRange(post.GetWorldLocation(), 1) )
                    from.SendLocalizedMessage(500295);

                else
                {
                    from.LocalOverheadMessage(MessageType.Regular, from.EmoteHue, false, "*ties the rope to the hitching post ring*");
                    from.SendMessage("Target the pet you wish to hitch.");

                    from.Target = new PostToPetTarget();
                }
            }
            else if( target is BaseCreature )
                from.SendMessage("You must tie the rope to a hitching post before being able to hitch your pet.");

            else if( target is PlayerMobile )
                from.SendMessage("The person looks at you in disgust.");

            else if( target == from )
                from.SendMessage("That would be a stupid idea.");
        }
开发者ID:ITLongwell,项目名称:Ulmeta,代码行数:26,代码来源:HitchToPostTarget.cs

示例13: OnDoubleClick

		public override void OnDoubleClick( Mobile from )
		{
			if ( from.InRange( GetWorldLocation(), 1 ) )
				UseGate( from );
			else
				from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 1019045 ); // I can't reach that
		}
开发者ID:nathanvy,项目名称:runuo,代码行数:7,代码来源:ArenaGump.cs

示例14: DestroyFurniture

		private void DestroyFurniture( Mobile from, Item item )
		{
			if ( !from.InRange( item.GetWorldLocation(), 3 ) )
			{
				from.SendLocalizedMessage( 500446 ); // That is too far away.
				return;
			}
			else if ( !item.IsChildOf( from.Backpack ) && !item.Movable )
			{
				from.SendLocalizedMessage( 500462 ); // You can't destroy that while it is here.
				return;
			}

			from.SendLocalizedMessage( 500461 ); // You destroy the item.
			Effects.PlaySound( item.GetWorldLocation(), item.Map, 0x3B3 );

			if ( item is Container )
			{
				if ( item is TrapableContainer )
					(item as TrapableContainer).ExecuteTrap( from );

				((Container)item).Destroy();
			}
			else
			{
				item.Delete();
			}
		}
开发者ID:ITLongwell,项目名称:aedilis2server,代码行数:28,代码来源:HarvestTarget.cs

示例15: HandlesOnSpeech

		public override bool HandlesOnSpeech( Mobile m )
		{
			if( m.InRange( this.Location, 2 ) && m.Alive && !m.Hidden && m_Board != null )
				return true;
			
			return base.HandlesOnSpeech( m );
		}
开发者ID:greeduomacro,项目名称:hubroot,代码行数:7,代码来源:DartGameNPC.cs


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