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


C# Gold.GetItemsInRange方法代码示例

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


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

示例1: OnDoubleClick

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

            // check the range between the player and weapon
            if (!from.InRange(this.Location, this.MinFiringRange) || from.Map != this.Map)
            {
                from.SendLocalizedMessage(500446); // That is too far away.
                return;
            }

            if (this.Storing)
            {
                from.SendMessage("{0} being stored", this.Name);
                return;
            }

            if (this.Projectile == null || this.Projectile.Deleted)
            {
                from.SendMessage("{0} empty", this.Name);
                return;
            }

            // check if the cannon is cool enough to fire
            if (this.NextFiring.Seconds > 0)
            {
                from.SendMessage("Not ready yet.");
                return;
            }
			
			//new way to fire
			Map map = Map;

			if ( map == null )
				return;

			int rx = 0, ry = 0;

			if ( Facing == 0 )
				rx = -1;
			else if ( Facing == 1 )
				ry = -1;
			else if ( Facing == 2 )
				rx = 1;
			else if ( Facing == 3 )
				ry = 1;

			for ( int i = 1; i <= 15; ++i )
			{
				int x = X + (i*rx);
				int y = Y + (i*ry);
				int z;

				for ( int j = -16; j <= 16; ++j )
				{
					z = from.Z + j;

					Point3D currentLocation = new Point3D( x, y, z );
					Item goldToken = new Gold(100);
					goldToken.Visible = false;
					goldToken.Map = Map;
					goldToken.Location = currentLocation;
					
					foreach (Item item in goldToken.GetItemsInRange(10))
						if (item is BaseShip)
						{
							BaseShip target = (BaseShip) item;
																	

							//Console.WriteLine("attacking {0} at {1}:{2}", multiitem, tileloc, ((StaticTarget)targeted).Location);
							// may have to reconsider the use tileloc vs target loc
							//m_cannon.AttackTarget(from, multiitem, ((StaticTarget)targeted).Location);
							if (target != this.Transport)
							{
								goldToken.Delete();
								return;
							}
							
						}

					goldToken.Delete();
						
				}

				z = map.GetAverageZ( x, y );


				Point3D currentLocation2 = new Point3D( x, y, z );
				Item goldToken2 = new Gold(100);
				goldToken2.Visible = false;
				goldToken2.Map = Map;
				goldToken2.Location = currentLocation2;
				foreach (Item item in goldToken2.GetItemsInRange(10))
					if (item is BaseShip)
					{
						BaseShip target = (BaseShip) item;
																

						//Console.WriteLine("attacking {0} at {1}:{2}", multiitem, tileloc, ((StaticTarget)targeted).Location);
//.........这里部分代码省略.........
开发者ID:greeduomacro,项目名称:UO-Forever,代码行数:101,代码来源:ShipCannons.cs


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