本文整理匯總了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);
}
}
}