本文整理汇总了C#中MiNET.Player.SpawnLevel方法的典型用法代码示例。如果您正苦于以下问题:C# Player.SpawnLevel方法的具体用法?C# Player.SpawnLevel怎么用?C# Player.SpawnLevel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MiNET.Player
的用法示例。
在下文中一共展示了Player.SpawnLevel方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Interact
public override bool Interact(Level currentLevel, Player player, BlockCoordinates blockCoordinates, BlockFace face)
{
Sign signEntity = currentLevel.GetBlockEntity(blockCoordinates) as Sign;
if (signEntity == null) return false;
string world = signEntity.Text1;
if (player.Level.LevelId.Equals(world)) return true;
if (!Worlds.ContainsKey(player.Level.LevelId))
{
Worlds.Add(player.Level.LevelId, player.Level);
}
if (!Worlds.ContainsKey(world))
{
var mobHuntLevel = new MobHuntLevel(world, new FlatlandWorldProvider());
mobHuntLevel.Initialize();
Worlds.Add(world, mobHuntLevel);
}
Level level = Worlds[world];
player.SpawnLevel(level);
level.BroadcastTextMessage(string.Format("{0} teleported to world <{1}>.", player.Username, level.LevelId));
return true;
}
示例2: Warp
public void Warp(Player player, string warp)
{
float x;
float y;
float z;
switch (warp)
{
case "sg1":
x = 137;
y = 20;
z = 431;
break;
case "sg2":
x = 682;
y = 20;
z = 324;
break;
case "sg3":
x = 685;
y = 20;
z = -119;
break;
default:
return;
}
var playerLocation = new PlayerLocation
{
X = x,
Y = y,
Z = z,
Yaw = 91,
Pitch = 28,
HeadYaw = 91
};
ThreadPool.QueueUserWorkItem(delegate(object state) { player.SpawnLevel(player.Level, playerLocation); }, null);
//player.Level.BroadcastMessage(string.Format("{0} teleported to coordinates {1},{2},{3}.", player.Username, x, y, z), type: MessageType.Raw);
}
示例3: Join
public Game Join(Player player, string world)
{
if (!Games.ContainsKey(player.Level.LevelId))
{
Games.Add(player.Level.LevelId, new Game(this)
{
Name = player.Level.LevelId,
Level = player.Level,
State = GameState.Undefined
});
}
if (!Games.ContainsKey(world))
{
if (!GameTemplates.ContainsKey(world)) return null;
GameSettings settings = GameTemplates[world];
Level gameLevel = new Level(settings.Name, new AnvilWorldProvider(settings.ArenaWorldPath));
gameLevel.Initialize();
var spawn = gameLevel.SpawnPoint;
if (!world.Equals("Default"))
{
gameLevel.SpawnPoint = new BlockCoordinates
{
X = spawn.X,
Y = spawn.Y + 20,
Z = spawn.Z,
};
}
Games.Add(world, new Game(this) {Name = world, Level = gameLevel, State = GameState.WaitingToStart});
}
Game currentGame = Games[player.Level.LevelId];
Game game = Games[world];
if (game.State == GameState.Started || game.State == GameState.Finshed)
{
return currentGame;
}
currentGame.RemovePlayer(player);
game.AddPlayer(player);
player.SpawnLevel(game.Level);
game.Level.BroadcastTextMessage(string.Format("{0} joined game <{1}>.", player.Username, game.Name));
return game;
}
示例4: Teleport
public void Teleport(Player player, string world)
{
if (player.Level.LevelId.Equals(world)) return;
if (!Context.LevelManager.Levels.Contains(player.Level))
{
Context.LevelManager.Levels.Add(player.Level);
}
ThreadPool.QueueUserWorkItem(delegate(object state)
{
Level[] levels = state as Level[];
if (levels != null)
{
Level nextLevel = levels.FirstOrDefault(l => l.LevelId != null && l.LevelId.Equals(world));
if (nextLevel == null)
{
nextLevel = new Level(world, new FlatlandWorldProvider());
nextLevel.Initialize();
Context.LevelManager.Levels.Add(nextLevel);
}
player.Level.BroadcastMessage(string.Format("{0} teleported to world {1}.", player.Username, nextLevel.LevelId), type: MessageType.Raw);
player.SpawnLevel(nextLevel);
}
}, Context.LevelManager.Levels.ToArray());
}
示例5: Teleport
public void Teleport(Player player, int x, int y, int z)
{
// send teleport to spawn
//player.SetPosition(
// new PlayerLocation
//{
// X = x,
// Y = y,
// Z = z,
// Yaw = 91,
// Pitch = 28,
// HeadYaw = 91
//}, true);
ThreadPool.QueueUserWorkItem(delegate(object state)
{
player.SpawnLevel(player.Level, new PlayerLocation
{
X = x,
Y = y,
Z = z,
Yaw = 91,
Pitch = 28,
HeadYaw = 91
});
}, null);
//player.Level.BroadcastMessage(string.Format("{0} teleported to coordinates {1},{2},{3}.", player.Username, x, y, z), type: MessageType.Raw);
}
示例6: Teleport
public void Teleport(Player player, string world)
{
Level oldLevel = player.Level;
if (player.Level.LevelId.Equals(world))
{
Teleport(player, (int) player.SpawnPosition.X, (int) player.SpawnPosition.Y, (int) player.SpawnPosition.Z);
return;
}
if (!Context.LevelManager.Levels.Contains(player.Level))
{
Context.LevelManager.Levels.Add(player.Level);
}
ThreadPool.QueueUserWorkItem(delegate(object state)
{
Level[] levels = state as Level[];
if (levels != null)
{
player.SpawnLevel(null, null, true, delegate
{
Level nextLevel = levels.FirstOrDefault(l => l.LevelId != null && l.LevelId.Equals(world));
if (nextLevel == null)
{
nextLevel = new Level(world, new FlatlandWorldProvider(), player.GameMode, Difficulty.Normal);
nextLevel.Initialize();
Context.LevelManager.Levels.Add(nextLevel);
}
return nextLevel;
});
oldLevel.BroadcastMessage(string.Format("{0} teleported to world {1}.", player.Username, player.Level.LevelId), type: MessageType.Raw);
}
}, Context.LevelManager.Levels.ToArray());
}