當前位置: 首頁>>代碼示例>>C#>>正文


C# Map.TransferObjectLater方法代碼示例

本文整理匯總了C#中WCell.RealmServer.Global.Map.TransferObjectLater方法的典型用法代碼示例。如果您正苦於以下問題:C# Map.TransferObjectLater方法的具體用法?C# Map.TransferObjectLater怎麽用?C# Map.TransferObjectLater使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在WCell.RealmServer.Global.Map的用法示例。


在下文中一共展示了Map.TransferObjectLater方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: TeleportTo

		/// <summary>
		/// Teleports the owner to the given position in the given map.
		/// </summary>
		/// <param name="map">the target <see cref="Map" /></param>
		/// <param name="pos">the target <see cref="Vector3">position</see></param>
		/// <param name="orientation">the target orientation</param>
		public void TeleportTo(Map map, ref Vector3 pos, float? orientation)
		{
			var ownerMap = m_Map;
			if (map.IsDisposed)
				return;

			// must not be moving or logging out when being teleported
			CancelMovement();
			CancelAllActions();
			if (this is Character)
			{
				((Character)this).CancelLogout();
			}

			if (ownerMap == map)
			{
				if (Map.MoveObject(this, ref pos))
				{
					if (orientation.HasValue)
						Orientation = orientation.Value;

					if (this is Character)
					{
						var chr = ((Character)this);
						chr.LastPosition = pos;

						MovementHandler.SendMoved(chr);
					}
				}
			}
			else
			{
				if (ownerMap != null && !ownerMap.IsInContext)
				{
					var position = pos;
					ownerMap.AddMessage(new Message(() => TeleportTo(map, ref position, orientation)));
				}
				else if (map.TransferObjectLater(this, pos))
				{
					if (orientation.HasValue)
					{
						Orientation = orientation.Value;
					}

					if (this is Character)
					{
						var chr = ((Character)this);
						chr.LastPosition = pos;

						MovementHandler.SendNewWorld(chr.Client, map.Id, ref pos, Orientation);
					}
				}
				else
				{
					// apparently, the target map has a colliding entity ID. this should NEVER 
					// happen for any kind of Unit

					log.Error("ERROR: Tried to teleport object, but failed to add player to the new map - " + this);
				}
			}
		}
開發者ID:MeaNone,項目名稱:WCell,代碼行數:67,代碼來源:Unit.Mechanics.cs


注:本文中的WCell.RealmServer.Global.Map.TransferObjectLater方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。