本文整理匯總了C#中Terraria.Player.Teleport方法的典型用法代碼示例。如果您正苦於以下問題:C# Player.Teleport方法的具體用法?C# Player.Teleport怎麽用?C# Player.Teleport使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Terraria.Player
的用法示例。
在下文中一共展示了Player.Teleport方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: OnPlayerPreUpdate
public void OnPlayerPreUpdate(Player player)
{
if (player.whoAmI != Main.myPlayer) return;
if (player.inventory[player.selectedItem].type == ItemID.CellPhone)
{
if (Main.mouseItem.type == ItemID.CellPhone) return; // don't allow it to be on your cursor
if (Main.mouseLeft && Main.mouseLeftRelease)
{
if (mode == Mode.Home) return;
player.mouseInterface = true;
Main.mouseLeftRelease = false;
if (mode == Mode.LeftOcean)
{
// left ocean
player.Teleport(new Vector2(200 * 16, (float)(Main.worldSurface / 2f) * 16f), 3);
if (!Main.tile[(int)(player.position.X / 16f), (int)(player.position.Y / 16f) + 3].active())
{
while (!Main.tile[(int)(player.position.X / 16f), (int)(player.position.Y / 16f) + 4].active())
{
player.position.Y += 16f;
}
}
else
{
while (Main.tile[(int)(player.position.X / 16f), (int)(player.position.Y / 16f) + 4].active())
{
player.position.Y -= 16f;
}
}
player.fallStart = (int)(player.position.Y / 16f);
if (Main.netMode == 1) NetMessage.SendTileSquare(player.whoAmI, 200, (int)Main.worldSurface / 2, 10);
}
else if (mode == Mode.RightOcean)
{
// right ocean
player.Teleport(new Vector2((Main.maxTilesX - 200) * 16, (float)(Main.worldSurface / 2f) * 16f), 3);
if (!Main.tile[(int)(player.position.X / 16f), (int)(player.position.Y / 16f) + 3].active())
{
while (!Main.tile[(int)(player.position.X / 16f), (int)(player.position.Y / 16f) + 4].active())
{
player.position.Y += 16f;
}
}
else
{
while (Main.tile[(int)(player.position.X / 16f), (int)(player.position.Y / 16f) + 4].active())
{
player.position.Y -= 16f;
}
}
player.fallStart = (int)(player.position.Y / 16f);
if (Main.netMode == 1) NetMessage.SendTileSquare(player.whoAmI, Main.maxTilesX - 200, (int)Main.worldSurface / 2, 10);
}
else if (mode == Mode.Hell)
{
// hell
player.Teleport(new Vector2((Main.maxTilesX / 2) * 16, (float)(Main.maxTilesY - 180) * 16f), 3);
if (!Main.tile[(int)(player.position.X / 16f), (int)(player.position.Y / 16f) + 3].active())
{
while (!Main.tile[(int)(player.position.X / 16f), (int)(player.position.Y / 16f) + 4].active())
{
player.position.Y += 16f;
if ((int)(player.position.Y / 16f) > Main.maxTilesY)
{
player.position.Y = (float)(Main.maxTilesY * 16) - 130f;
break;
}
}
}
else
{
while (Main.tile[(int)(player.position.X / 16f), (int)(player.position.Y / 16f) + 4].active())
{
player.position.Y -= 16f;
}
}
player.fallStart = (int)(player.position.Y / 16f);
if (Main.netMode == 1) NetMessage.SendTileSquare(player.whoAmI, Main.maxTilesX / 2, (int)Main.maxTilesY - 180, 10);
}
else if (mode == Mode.Random)
{
if (Main.netMode == 0)
{
player.TeleportationPotion();
}
else if (Main.netMode == 1 && player.whoAmI == Main.myPlayer)
{
NetMessage.SendData(73, -1, -1, "", 0, 0f, 0f, 0f, 0);
}
}
for (int num91 = 0; num91 < 70; num91++)
{
Dust.NewDust(player.position, player.width, player.height, 15, 0f, 0f, 150, default(Color), 1.5f);
}
}
}
}